Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi
hcloud.getServers
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const s3 = hcloud.getServers({
    withSelector: "key=value",
});
import pulumi
import pulumi_hcloud as hcloud
s3 = hcloud.get_servers(with_selector="key=value")
package main
import (
	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := hcloud.GetServers(ctx, &hcloud.GetServersArgs{
			WithSelector: pulumi.StringRef("key=value"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;
return await Deployment.RunAsync(() => 
{
    var s3 = HCloud.GetServers.Invoke(new()
    {
        WithSelector = "key=value",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.HcloudFunctions;
import com.pulumi.hcloud.inputs.GetServersArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var s3 = HcloudFunctions.getServers(GetServersArgs.builder()
            .withSelector("key=value")
            .build());
    }
}
variables:
  s3:
    fn::invoke:
      function: hcloud:getServers
      arguments:
        withSelector: key=value
Using getServers
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getServers(args: GetServersArgs, opts?: InvokeOptions): Promise<GetServersResult>
function getServersOutput(args: GetServersOutputArgs, opts?: InvokeOptions): Output<GetServersResult>def get_servers(with_selector: Optional[str] = None,
                with_statuses: Optional[Sequence[str]] = None,
                opts: Optional[InvokeOptions] = None) -> GetServersResult
def get_servers_output(with_selector: Optional[pulumi.Input[str]] = None,
                with_statuses: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetServersResult]func GetServers(ctx *Context, args *GetServersArgs, opts ...InvokeOption) (*GetServersResult, error)
func GetServersOutput(ctx *Context, args *GetServersOutputArgs, opts ...InvokeOption) GetServersResultOutput> Note: This function is named GetServers in the Go SDK.
public static class GetServers 
{
    public static Task<GetServersResult> InvokeAsync(GetServersArgs args, InvokeOptions? opts = null)
    public static Output<GetServersResult> Invoke(GetServersInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetServersResult> getServers(GetServersArgs args, InvokeOptions options)
public static Output<GetServersResult> getServers(GetServersArgs args, InvokeOptions options)
fn::invoke:
  function: hcloud:index/getServers:getServers
  arguments:
    # arguments dictionaryThe following arguments are supported:
- WithSelector string
- Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- WithStatuses List<string>
- List only servers with the specified status, could contain initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- WithSelector string
- Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- WithStatuses []string
- List only servers with the specified status, could contain initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- withSelector String
- Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- withStatuses List<String>
- List only servers with the specified status, could contain initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- withSelector string
- Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- withStatuses string[]
- List only servers with the specified status, could contain initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- with_selector str
- Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with_statuses Sequence[str]
- List only servers with the specified status, could contain initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- withSelector String
- Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- withStatuses List<String>
- List only servers with the specified status, could contain initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
getServers Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Servers
List<Pulumi.HCloud. Outputs. Get Servers Server> 
- (list) List of all matching servers. See data.hcloud_serverfor schema.
- WithSelector string
- WithStatuses List<string>
- Id string
- The provider-assigned unique ID for this managed resource.
- Servers
[]GetServers Server 
- (list) List of all matching servers. See data.hcloud_serverfor schema.
- WithSelector string
- WithStatuses []string
- id String
- The provider-assigned unique ID for this managed resource.
- servers
List<GetServers Server> 
- (list) List of all matching servers. See data.hcloud_serverfor schema.
- withSelector String
- withStatuses List<String>
- id string
- The provider-assigned unique ID for this managed resource.
- servers
GetServers Server[] 
- (list) List of all matching servers. See data.hcloud_serverfor schema.
- withSelector string
- withStatuses string[]
- id str
- The provider-assigned unique ID for this managed resource.
- servers
Sequence[GetServers Server] 
- (list) List of all matching servers. See data.hcloud_serverfor schema.
- with_selector str
- with_statuses Sequence[str]
- id String
- The provider-assigned unique ID for this managed resource.
- servers List<Property Map>
- (list) List of all matching servers. See data.hcloud_serverfor schema.
- withSelector String
- withStatuses List<String>
Supporting Types
GetServersServer  
- BackupWindow string
- Backups bool
- Datacenter string
- DeleteProtection bool
- FirewallIds List<int>
- Id int
- Image string
- Ipv4Address string
- Ipv6Address string
- Ipv6Network string
- Iso string
- Labels Dictionary<string, string>
- Location string
- Name string
- PrimaryDisk intSize 
- RebuildProtection bool
- Rescue string
- ServerType string
- Status string
- PlacementGroup intId 
- BackupWindow string
- Backups bool
- Datacenter string
- DeleteProtection bool
- FirewallIds []int
- Id int
- Image string
- Ipv4Address string
- Ipv6Address string
- Ipv6Network string
- Iso string
- Labels map[string]string
- Location string
- Name string
- PrimaryDisk intSize 
- RebuildProtection bool
- Rescue string
- ServerType string
- Status string
- PlacementGroup intId 
- backupWindow String
- backups Boolean
- datacenter String
- deleteProtection Boolean
- firewallIds List<Integer>
- id Integer
- image String
- ipv4Address String
- ipv6Address String
- ipv6Network String
- iso String
- labels Map<String,String>
- location String
- name String
- primaryDisk IntegerSize 
- rebuildProtection Boolean
- rescue String
- serverType String
- status String
- placementGroup IntegerId 
- backupWindow string
- backups boolean
- datacenter string
- deleteProtection boolean
- firewallIds number[]
- id number
- image string
- ipv4Address string
- ipv6Address string
- ipv6Network string
- iso string
- labels {[key: string]: string}
- location string
- name string
- primaryDisk numberSize 
- rebuildProtection boolean
- rescue string
- serverType string
- status string
- placementGroup numberId 
- backup_window str
- backups bool
- datacenter str
- delete_protection bool
- firewall_ids Sequence[int]
- id int
- image str
- ipv4_address str
- ipv6_address str
- ipv6_network str
- iso str
- labels Mapping[str, str]
- location str
- name str
- primary_disk_ intsize 
- rebuild_protection bool
- rescue str
- server_type str
- status str
- placement_group_ intid 
- backupWindow String
- backups Boolean
- datacenter String
- deleteProtection Boolean
- firewallIds List<Number>
- id Number
- image String
- ipv4Address String
- ipv6Address String
- ipv6Network String
- iso String
- labels Map<String>
- location String
- name String
- primaryDisk NumberSize 
- rebuildProtection Boolean
- rescue String
- serverType String
- status String
- placementGroup NumberId 
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the hcloudTerraform Provider.