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",
                ServerType = "cx31",
                Location = ds.Apply(ds => ds.Names)[range.Value],
            }));
        }
    }

}

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",
        server_type="cx31",
        location=ds.names[range["value"]]))
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const ds = hcloud.getLocations({});
const workers: hcloud.Server[];
for (const range = {value: 0}; range.value < 3; range.value++) {
    workers.push(new hcloud.Server(`workers-${range.value}`, {
        image: "debian-9",
        serverType: "cx31",
        location: ds.then(ds => ds.names)[range.value],
    }));
}

Using getLocations

function getLocations(args: GetLocationsArgs, opts?: InvokeOptions): Promise<GetLocationsResult>
def get_locations(location_ids: Optional[Sequence[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetLocationsResult
func GetLocations(ctx *Context, args *GetLocationsArgs, opts ...InvokeOption) (*GetLocationsResult, error)

Note: This function is named GetLocations in the Go SDK.

public static class GetLocations {
    public static Task<GetLocationsResult> InvokeAsync(GetLocationsArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

LocationIds List<string>
(list) List of unique location identifiers.
LocationIds []string
(list) List of unique location identifiers.
locationIds string[]
(list) List of unique location identifiers.
location_ids Sequence[str]
(list) List of unique location identifiers.

getLocations Result

The following output properties are available:

Descriptions List<string>
(list) List of all location descriptions.
Id string
The provider-assigned unique ID for this managed resource.
Names List<string>
(list) List of location names.
LocationIds List<string>
(list) List of unique location identifiers.
Descriptions []string
(list) List of all location descriptions.
Id string
The provider-assigned unique ID for this managed resource.
Names []string
(list) List of location names.
LocationIds []string
(list) List of unique location identifiers.
descriptions string[]
(list) List of all location descriptions.
id string
The provider-assigned unique ID for this managed resource.
names string[]
(list) List of location names.
locationIds string[]
(list) List of unique location identifiers.
descriptions Sequence[str]
(list) List of all location descriptions.
id str
The provider-assigned unique ID for this managed resource.
names Sequence[str]
(list) List of location names.
location_ids Sequence[str]
(list) List of unique location identifiers.

Package Details

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