GetDatacenters

Provides a list of available Hetzner Cloud Datacenters. This resource may be useful to create highly available infrastructure, distributed across several datacenters.

Example Usage

using System.Collections.Generic;
using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var ds = Output.Create(HCloud.GetDatacenters.InvokeAsync());
        var workers = new List<HCloud.Server>();
        for (var rangeIndex = 0; rangeIndex < 3; rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            workers.Add(new HCloud.Server($"workers-{range.Value}", new HCloud.ServerArgs
            {
                Datacenter = ds.Apply(ds => ds.Names)[range.Value],
                Image = "debian-9",
                ServerType = "cx31",
            }));
        }
    }

}

Coming soon!

import pulumi
import pulumi_hcloud as hcloud

ds = hcloud.get_datacenters()
workers = []
for range in [{"value": i} for i in range(0, 3)]:
    workers.append(hcloud.Server(f"workers-{range['value']}",
        datacenter=ds.names[range["value"]],
        image="debian-9",
        server_type="cx31"))
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const ds = pulumi.output(hcloud.getDatacenters({ async: true }));
const workers: hcloud.Server[] = [];
for (let i = 0; i < 3; i++) {
    workers.push(new hcloud.Server(`workers-${i}`, {
        datacenter: ds.apply(ds => ds.names[i]),
        image: "debian-9",
        serverType: "cx31",
    }));
}

Using GetDatacenters

function getDatacenters(args: GetDatacentersArgs, opts?: InvokeOptions): Promise<GetDatacentersResult>
function  get_datacenters(datacenter_ids=None, opts=None)
func GetDatacenters(ctx *Context, args *GetDatacentersArgs, opts ...InvokeOption) (*GetDatacentersResult, error)
public static class GetDatacenters {
    public static Task<GetDatacentersResult> InvokeAsync(GetDatacentersArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

DatacenterIds List<string>
DatacenterIds []string
datacenterIds string[]
datacenter_ids List[str]

GetDatacenters Result

The following output properties are available:

Descriptions List<string>
Id string

The provider-assigned unique ID for this managed resource.

Names List<string>
DatacenterIds List<string>
Descriptions []string
Id string

The provider-assigned unique ID for this managed resource.

Names []string
DatacenterIds []string
descriptions string[]
id string

The provider-assigned unique ID for this managed resource.

names string[]
datacenterIds string[]
descriptions List[str]
id str

The provider-assigned unique ID for this managed resource.

names List[str]
datacenter_ids List[str]

Package Details

Repository
https://github.com/pulumi/pulumi-hcloud
License
Apache-2.0
Notes
This Pulumi package is based on the hcloud Terraform Provider.