GetLocations

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

Example Usage

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

class MyStack : Stack
{
    public MyStack()
    {
        var ds = Output.Create(HCloud.GetLocations.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
            {
                Image = "debian-9",
                Location = ds.Apply(ds => ds.Names)[range.Value],
                ServerType = "cx31",
            }));
        }
    }

}

Coming soon!

import pulumi
import pulumi_hcloud as hcloud

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

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

Using GetLocations

function getLocations(args: GetLocationsArgs, opts?: InvokeOptions): Promise<GetLocationsResult>
function  get_locations(location_ids=None, opts=None)
func GetLocations(ctx *Context, args *GetLocationsArgs, opts ...InvokeOption) (*GetLocationsResult, error)
public static class GetLocations {
    public static Task<GetLocationsResult> InvokeAsync(GetLocationsArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

LocationIds List<string>
LocationIds []string
locationIds string[]
location_ids List[str]

GetLocations Result

The following output properties are available:

Descriptions List<string>
Id string

The provider-assigned unique ID for this managed resource.

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

The provider-assigned unique ID for this managed resource.

Names []string
LocationIds []string
descriptions string[]
id string

The provider-assigned unique ID for this managed resource.

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

The provider-assigned unique ID for this managed resource.

names List[str]
location_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.