1. Packages
  2. Hcloud Provider
  3. API Docs
  4. getPlacementGroup
Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi

hcloud.getPlacementGroup

Explore with Pulumi AI

Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi

Provides details about a specific Hetzner Cloud Placement Group.

import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const samplePlacementGroup1 = hcloud.getPlacementGroup({
    name: "sample-placement-group-1",
});
const samplePlacementGroup2 = hcloud.getPlacementGroup({
    id: 4711,
});
Copy
import pulumi
import pulumi_hcloud as hcloud

sample_placement_group1 = hcloud.get_placement_group(name="sample-placement-group-1")
sample_placement_group2 = hcloud.get_placement_group(id=4711)
Copy
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.LookupPlacementGroup(ctx, &hcloud.LookupPlacementGroupArgs{
			Name: pulumi.StringRef("sample-placement-group-1"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.LookupPlacementGroup(ctx, &hcloud.LookupPlacementGroupArgs{
			Id: pulumi.IntRef(4711),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    var samplePlacementGroup1 = HCloud.GetPlacementGroup.Invoke(new()
    {
        Name = "sample-placement-group-1",
    });

    var samplePlacementGroup2 = HCloud.GetPlacementGroup.Invoke(new()
    {
        Id = 4711,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.HcloudFunctions;
import com.pulumi.hcloud.inputs.GetPlacementGroupArgs;
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) {
        final var samplePlacementGroup1 = HcloudFunctions.getPlacementGroup(GetPlacementGroupArgs.builder()
            .name("sample-placement-group-1")
            .build());

        final var samplePlacementGroup2 = HcloudFunctions.getPlacementGroup(GetPlacementGroupArgs.builder()
            .id("4711")
            .build());

    }
}
Copy
variables:
  samplePlacementGroup1:
    fn::invoke:
      function: hcloud:getPlacementGroup
      arguments:
        name: sample-placement-group-1
  samplePlacementGroup2:
    fn::invoke:
      function: hcloud:getPlacementGroup
      arguments:
        id: '4711'
Copy

Using getPlacementGroup

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getPlacementGroup(args: GetPlacementGroupArgs, opts?: InvokeOptions): Promise<GetPlacementGroupResult>
function getPlacementGroupOutput(args: GetPlacementGroupOutputArgs, opts?: InvokeOptions): Output<GetPlacementGroupResult>
Copy
def get_placement_group(id: Optional[int] = None,
                        labels: Optional[Mapping[str, str]] = None,
                        most_recent: Optional[bool] = None,
                        name: Optional[str] = None,
                        type: Optional[str] = None,
                        with_selector: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetPlacementGroupResult
def get_placement_group_output(id: Optional[pulumi.Input[int]] = None,
                        labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                        most_recent: Optional[pulumi.Input[bool]] = None,
                        name: Optional[pulumi.Input[str]] = None,
                        type: Optional[pulumi.Input[str]] = None,
                        with_selector: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetPlacementGroupResult]
Copy
func LookupPlacementGroup(ctx *Context, args *LookupPlacementGroupArgs, opts ...InvokeOption) (*LookupPlacementGroupResult, error)
func LookupPlacementGroupOutput(ctx *Context, args *LookupPlacementGroupOutputArgs, opts ...InvokeOption) LookupPlacementGroupResultOutput
Copy

> Note: This function is named LookupPlacementGroup in the Go SDK.

public static class GetPlacementGroup 
{
    public static Task<GetPlacementGroupResult> InvokeAsync(GetPlacementGroupArgs args, InvokeOptions? opts = null)
    public static Output<GetPlacementGroupResult> Invoke(GetPlacementGroupInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetPlacementGroupResult> getPlacementGroup(GetPlacementGroupArgs args, InvokeOptions options)
public static Output<GetPlacementGroupResult> getPlacementGroup(GetPlacementGroupArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: hcloud:index/getPlacementGroup:getPlacementGroup
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Id int
ID of the placement group.
Labels Dictionary<string, string>
(map) User-defined labels (key-value pairs)
MostRecent bool
Return most recent placement group if multiple are found.
Name string
Name of the placement group.
Type string
(string) Type of the Placement Group.
WithSelector string
Label selector
Id int
ID of the placement group.
Labels map[string]string
(map) User-defined labels (key-value pairs)
MostRecent bool
Return most recent placement group if multiple are found.
Name string
Name of the placement group.
Type string
(string) Type of the Placement Group.
WithSelector string
Label selector
id Integer
ID of the placement group.
labels Map<String,String>
(map) User-defined labels (key-value pairs)
mostRecent Boolean
Return most recent placement group if multiple are found.
name String
Name of the placement group.
type String
(string) Type of the Placement Group.
withSelector String
Label selector
id number
ID of the placement group.
labels {[key: string]: string}
(map) User-defined labels (key-value pairs)
mostRecent boolean
Return most recent placement group if multiple are found.
name string
Name of the placement group.
type string
(string) Type of the Placement Group.
withSelector string
Label selector
id int
ID of the placement group.
labels Mapping[str, str]
(map) User-defined labels (key-value pairs)
most_recent bool
Return most recent placement group if multiple are found.
name str
Name of the placement group.
type str
(string) Type of the Placement Group.
with_selector str
Label selector
id Number
ID of the placement group.
labels Map<String>
(map) User-defined labels (key-value pairs)
mostRecent Boolean
Return most recent placement group if multiple are found.
name String
Name of the placement group.
type String
(string) Type of the Placement Group.
withSelector String
Label selector

getPlacementGroup Result

The following output properties are available:

Id int
(int) Unique ID of the Placement Group.
Labels Dictionary<string, string>
(map) User-defined labels (key-value pairs)
Name string
(string) Name of the Placement Group.
Servers List<int>
Type string
(string) Type of the Placement Group.
MostRecent bool
WithSelector string
Id int
(int) Unique ID of the Placement Group.
Labels map[string]string
(map) User-defined labels (key-value pairs)
Name string
(string) Name of the Placement Group.
Servers []int
Type string
(string) Type of the Placement Group.
MostRecent bool
WithSelector string
id Integer
(int) Unique ID of the Placement Group.
labels Map<String,String>
(map) User-defined labels (key-value pairs)
name String
(string) Name of the Placement Group.
servers List<Integer>
type String
(string) Type of the Placement Group.
mostRecent Boolean
withSelector String
id number
(int) Unique ID of the Placement Group.
labels {[key: string]: string}
(map) User-defined labels (key-value pairs)
name string
(string) Name of the Placement Group.
servers number[]
type string
(string) Type of the Placement Group.
mostRecent boolean
withSelector string
id int
(int) Unique ID of the Placement Group.
labels Mapping[str, str]
(map) User-defined labels (key-value pairs)
name str
(string) Name of the Placement Group.
servers Sequence[int]
type str
(string) Type of the Placement Group.
most_recent bool
with_selector str
id Number
(int) Unique ID of the Placement Group.
labels Map<String>
(map) User-defined labels (key-value pairs)
name String
(string) Name of the Placement Group.
servers List<Number>
type String
(string) Type of the Placement Group.
mostRecent Boolean
withSelector String

Package Details

Repository
Hetzner Cloud pulumi/pulumi-hcloud
License
Apache-2.0
Notes
This Pulumi package is based on the hcloud Terraform Provider.
Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi