hcloud logo
Hetzner Cloud v1.10.3, Mar 8 23

hcloud.PlacementGroup

Provides a Hetzner Cloud Placement Group to represent a Placement Group in the Hetzner Cloud.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var my_placement_group = new HCloud.PlacementGroup("my-placement-group", new()
    {
        Type = "spread",
        Labels = 
        {
            { "key", "value" },
        },
    });

    var node1 = new HCloud.Server("node1", new()
    {
        Image = "debian-9",
        ServerType = "cx11",
        PlacementGroupId = my_placement_group.Id,
    });

});
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.NewPlacementGroup(ctx, "my-placement-group", &hcloud.PlacementGroupArgs{
			Type: pulumi.String("spread"),
			Labels: pulumi.AnyMap{
				"key": pulumi.Any("value"),
			},
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewServer(ctx, "node1", &hcloud.ServerArgs{
			Image:            pulumi.String("debian-9"),
			ServerType:       pulumi.String("cx11"),
			PlacementGroupId: my_placement_group.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.PlacementGroup;
import com.pulumi.hcloud.PlacementGroupArgs;
import com.pulumi.hcloud.Server;
import com.pulumi.hcloud.ServerArgs;
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) {
        var my_placement_group = new PlacementGroup("my-placement-group", PlacementGroupArgs.builder()        
            .type("spread")
            .labels(Map.of("key", "value"))
            .build());

        var node1 = new Server("node1", ServerArgs.builder()        
            .image("debian-9")
            .serverType("cx11")
            .placementGroupId(my_placement_group.id())
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

my_placement_group = hcloud.PlacementGroup("my-placement-group",
    type="spread",
    labels={
        "key": "value",
    })
node1 = hcloud.Server("node1",
    image="debian-9",
    server_type="cx11",
    placement_group_id=my_placement_group.id)
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const my_placement_group = new hcloud.PlacementGroup("my-placement-group", {
    type: "spread",
    labels: {
        key: "value",
    },
});
const node1 = new hcloud.Server("node1", {
    image: "debian-9",
    serverType: "cx11",
    placementGroupId: my_placement_group.id,
});
resources:
  my-placement-group:
    type: hcloud:PlacementGroup
    properties:
      type: spread
      labels:
        key: value
  node1:
    type: hcloud:Server
    properties:
      image: debian-9
      serverType: cx11
      placementGroupId: ${["my-placement-group"].id}

Create PlacementGroup Resource

new PlacementGroup(name: string, args: PlacementGroupArgs, opts?: CustomResourceOptions);
@overload
def PlacementGroup(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   labels: Optional[Mapping[str, Any]] = None,
                   name: Optional[str] = None,
                   type: Optional[str] = None)
@overload
def PlacementGroup(resource_name: str,
                   args: PlacementGroupArgs,
                   opts: Optional[ResourceOptions] = None)
func NewPlacementGroup(ctx *Context, name string, args PlacementGroupArgs, opts ...ResourceOption) (*PlacementGroup, error)
public PlacementGroup(string name, PlacementGroupArgs args, CustomResourceOptions? opts = null)
public PlacementGroup(String name, PlacementGroupArgs args)
public PlacementGroup(String name, PlacementGroupArgs args, CustomResourceOptions options)
type: hcloud:PlacementGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args PlacementGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args PlacementGroupArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args PlacementGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args PlacementGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args PlacementGroupArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

PlacementGroup Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The PlacementGroup resource accepts the following input properties:

Type string

Type of the Placement Group.

Labels Dictionary<string, object>

User-defined labels (key-value pairs) should be created with.

Name string

Name of the Placement Group.

Type string

Type of the Placement Group.

Labels map[string]interface{}

User-defined labels (key-value pairs) should be created with.

Name string

Name of the Placement Group.

type String

Type of the Placement Group.

labels Map<String,Object>

User-defined labels (key-value pairs) should be created with.

name String

Name of the Placement Group.

type string

Type of the Placement Group.

labels {[key: string]: any}

User-defined labels (key-value pairs) should be created with.

name string

Name of the Placement Group.

type str

Type of the Placement Group.

labels Mapping[str, Any]

User-defined labels (key-value pairs) should be created with.

name str

Name of the Placement Group.

type String

Type of the Placement Group.

labels Map<Any>

User-defined labels (key-value pairs) should be created with.

name String

Name of the Placement Group.

Outputs

All input properties are implicitly available as output properties. Additionally, the PlacementGroup resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Servers List<int>
Id string

The provider-assigned unique ID for this managed resource.

Servers []int
id String

The provider-assigned unique ID for this managed resource.

servers List<Integer>
id string

The provider-assigned unique ID for this managed resource.

servers number[]
id str

The provider-assigned unique ID for this managed resource.

servers Sequence[int]
id String

The provider-assigned unique ID for this managed resource.

servers List<Number>

Look up Existing PlacementGroup Resource

Get an existing PlacementGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: PlacementGroupState, opts?: CustomResourceOptions): PlacementGroup
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        labels: Optional[Mapping[str, Any]] = None,
        name: Optional[str] = None,
        servers: Optional[Sequence[int]] = None,
        type: Optional[str] = None) -> PlacementGroup
func GetPlacementGroup(ctx *Context, name string, id IDInput, state *PlacementGroupState, opts ...ResourceOption) (*PlacementGroup, error)
public static PlacementGroup Get(string name, Input<string> id, PlacementGroupState? state, CustomResourceOptions? opts = null)
public static PlacementGroup get(String name, Output<String> id, PlacementGroupState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Labels Dictionary<string, object>

User-defined labels (key-value pairs) should be created with.

Name string

Name of the Placement Group.

Servers List<int>
Type string

Type of the Placement Group.

Labels map[string]interface{}

User-defined labels (key-value pairs) should be created with.

Name string

Name of the Placement Group.

Servers []int
Type string

Type of the Placement Group.

labels Map<String,Object>

User-defined labels (key-value pairs) should be created with.

name String

Name of the Placement Group.

servers List<Integer>
type String

Type of the Placement Group.

labels {[key: string]: any}

User-defined labels (key-value pairs) should be created with.

name string

Name of the Placement Group.

servers number[]
type string

Type of the Placement Group.

labels Mapping[str, Any]

User-defined labels (key-value pairs) should be created with.

name str

Name of the Placement Group.

servers Sequence[int]
type str

Type of the Placement Group.

labels Map<Any>

User-defined labels (key-value pairs) should be created with.

name String

Name of the Placement Group.

servers List<Number>
type String

Type of the Placement Group.

Import

Placement Groups can be imported using its id

 $ pulumi import hcloud:index/placementGroup:PlacementGroup my-placement-group id

Package Details

Repository
Hetzner Cloud pulumi/pulumi-hcloud
License
Apache-2.0
Notes

This Pulumi package is based on the hcloud Terraform Provider.