1. Packages
  2. Hcloud Provider
  3. API Docs
  4. getServers
Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi

hcloud.getServers

Explore with Pulumi AI

Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const s3 = hcloud.getServers({
    withSelector: "key=value",
});
Copy
import pulumi
import pulumi_hcloud as hcloud

s3 = hcloud.get_servers(with_selector="key=value")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
variables:
  s3:
    fn::invoke:
      function: hcloud:getServers
      arguments:
        withSelector: key=value
Copy

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>
Copy
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]
Copy
func GetServers(ctx *Context, args *GetServersArgs, opts ...InvokeOption) (*GetServersResult, error)
func GetServersOutput(ctx *Context, args *GetServersOutputArgs, opts ...InvokeOption) GetServersResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetServersResult> getServers(GetServersArgs args, InvokeOptions options)
public static Output<GetServersResult> getServers(GetServersArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: hcloud:index/getServers:getServers
  arguments:
    # arguments dictionary
Copy

The 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.GetServersServer>
(list) List of all matching servers. See data.hcloud_server for schema.
WithSelector string
WithStatuses List<string>
Id string
The provider-assigned unique ID for this managed resource.
Servers []GetServersServer
(list) List of all matching servers. See data.hcloud_server for schema.
WithSelector string
WithStatuses []string
id String
The provider-assigned unique ID for this managed resource.
servers List<GetServersServer>
(list) List of all matching servers. See data.hcloud_server for schema.
withSelector String
withStatuses List<String>
id string
The provider-assigned unique ID for this managed resource.
servers GetServersServer[]
(list) List of all matching servers. See data.hcloud_server for schema.
withSelector string
withStatuses string[]
id str
The provider-assigned unique ID for this managed resource.
servers Sequence[GetServersServer]
(list) List of all matching servers. See data.hcloud_server for 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_server for schema.
withSelector String
withStatuses List<String>

Supporting Types

GetServersServer

BackupWindow This property is required. string
Backups This property is required. bool
Datacenter This property is required. string
DeleteProtection This property is required. bool
FirewallIds This property is required. List<int>
Id This property is required. int
Image This property is required. string
Ipv4Address This property is required. string
Ipv6Address This property is required. string
Ipv6Network This property is required. string
Iso This property is required. string
Labels This property is required. Dictionary<string, string>
Location This property is required. string
Name This property is required. string
PrimaryDiskSize This property is required. int
RebuildProtection This property is required. bool
Rescue This property is required. string
ServerType This property is required. string
Status This property is required. string
PlacementGroupId int
BackupWindow This property is required. string
Backups This property is required. bool
Datacenter This property is required. string
DeleteProtection This property is required. bool
FirewallIds This property is required. []int
Id This property is required. int
Image This property is required. string
Ipv4Address This property is required. string
Ipv6Address This property is required. string
Ipv6Network This property is required. string
Iso This property is required. string
Labels This property is required. map[string]string
Location This property is required. string
Name This property is required. string
PrimaryDiskSize This property is required. int
RebuildProtection This property is required. bool
Rescue This property is required. string
ServerType This property is required. string
Status This property is required. string
PlacementGroupId int
backupWindow This property is required. String
backups This property is required. Boolean
datacenter This property is required. String
deleteProtection This property is required. Boolean
firewallIds This property is required. List<Integer>
id This property is required. Integer
image This property is required. String
ipv4Address This property is required. String
ipv6Address This property is required. String
ipv6Network This property is required. String
iso This property is required. String
labels This property is required. Map<String,String>
location This property is required. String
name This property is required. String
primaryDiskSize This property is required. Integer
rebuildProtection This property is required. Boolean
rescue This property is required. String
serverType This property is required. String
status This property is required. String
placementGroupId Integer
backupWindow This property is required. string
backups This property is required. boolean
datacenter This property is required. string
deleteProtection This property is required. boolean
firewallIds This property is required. number[]
id This property is required. number
image This property is required. string
ipv4Address This property is required. string
ipv6Address This property is required. string
ipv6Network This property is required. string
iso This property is required. string
labels This property is required. {[key: string]: string}
location This property is required. string
name This property is required. string
primaryDiskSize This property is required. number
rebuildProtection This property is required. boolean
rescue This property is required. string
serverType This property is required. string
status This property is required. string
placementGroupId number
backup_window This property is required. str
backups This property is required. bool
datacenter This property is required. str
delete_protection This property is required. bool
firewall_ids This property is required. Sequence[int]
id This property is required. int
image This property is required. str
ipv4_address This property is required. str
ipv6_address This property is required. str
ipv6_network This property is required. str
iso This property is required. str
labels This property is required. Mapping[str, str]
location This property is required. str
name This property is required. str
primary_disk_size This property is required. int
rebuild_protection This property is required. bool
rescue This property is required. str
server_type This property is required. str
status This property is required. str
placement_group_id int
backupWindow This property is required. String
backups This property is required. Boolean
datacenter This property is required. String
deleteProtection This property is required. Boolean
firewallIds This property is required. List<Number>
id This property is required. Number
image This property is required. String
ipv4Address This property is required. String
ipv6Address This property is required. String
ipv6Network This property is required. String
iso This property is required. String
labels This property is required. Map<String>
location This property is required. String
name This property is required. String
primaryDiskSize This property is required. Number
rebuildProtection This property is required. Boolean
rescue This property is required. String
serverType This property is required. String
status This property is required. String
placementGroupId Number

Package Details

Repository
Hetzner Cloud pulumi/pulumi-hcloud
License
Apache-2.0
Notes
This Pulumi package is based on the hcloud Terraform Provider.
Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi