Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

GetServerTypes

Provides a list of available Hetzner Cloud Server Types.

Example Usage

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

class MyStack : Stack
{
    public MyStack()
    {
        var ds = Output.Create(HCloud.GetServerTypes.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 = ds.Apply(ds => ds.Names)[range.Value],
            }));
        }
    }

}

Coming soon!

import pulumi
import pulumi_hcloud as hcloud

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

const ds = hcloud.getServerTypes({});
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: ds.then(ds => ds.names)[range.value],
    }));
}

Using GetServerTypes

function getServerTypes(args: GetServerTypesArgs, opts?: InvokeOptions): Promise<GetServerTypesResult>
def get_server_types(server_type_ids: Optional[Sequence[str]] = None, opts: Optional[InvokeOptions] = None) -> GetServerTypesResult
func GetServerTypes(ctx *Context, args *GetServerTypesArgs, opts ...InvokeOption) (*GetServerTypesResult, error)
public static class GetServerTypes {
    public static Task<GetServerTypesResult> InvokeAsync(GetServerTypesArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

ServerTypeIds List<string>

(list) List of unique Server Types identifiers.

ServerTypeIds []string

(list) List of unique Server Types identifiers.

serverTypeIds string[]

(list) List of unique Server Types identifiers.

server_type_ids Sequence[str]

(list) List of unique Server Types identifiers.

GetServerTypes Result

The following output properties are available:

Descriptions List<string>

(list) List of all Server Types descriptions.

Id string

The provider-assigned unique ID for this managed resource.

Names List<string>

(list) List of Server Types names.

ServerTypeIds List<string>

(list) List of unique Server Types identifiers.

Descriptions []string

(list) List of all Server Types descriptions.

Id string

The provider-assigned unique ID for this managed resource.

Names []string

(list) List of Server Types names.

ServerTypeIds []string

(list) List of unique Server Types identifiers.

descriptions string[]

(list) List of all Server Types descriptions.

id string

The provider-assigned unique ID for this managed resource.

names string[]

(list) List of Server Types names.

serverTypeIds string[]

(list) List of unique Server Types identifiers.

descriptions Sequence[str]

(list) List of all Server Types descriptions.

id str

The provider-assigned unique ID for this managed resource.

names Sequence[str]

(list) List of Server Types names.

server_type_ids Sequence[str]

(list) List of unique Server Types 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.