1. Packages
  2. Ibm Provider
  3. API Docs
  4. getComputePlacementGroup
ibm 1.77.1 published on Monday, Apr 14, 2025 by ibm-cloud

ibm.getComputePlacementGroup

Explore with Pulumi AI

Retrieve information of an existing placement group as a read-only data source. For more information, about compute placement group resource, see workload Placement for virtual servers.

Example Usage

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

const group = ibm.getComputePlacementGroup({
    name: "demo",
});
Copy
import pulumi
import pulumi_ibm as ibm

group = ibm.get_compute_placement_group(name="demo")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ibm.LookupComputePlacementGroup(ctx, &ibm.LookupComputePlacementGroupArgs{
			Name: "demo",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;

return await Deployment.RunAsync(() => 
{
    var @group = Ibm.GetComputePlacementGroup.Invoke(new()
    {
        Name = "demo",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.IbmFunctions;
import com.pulumi.ibm.inputs.GetComputePlacementGroupArgs;
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 group = IbmFunctions.getComputePlacementGroup(GetComputePlacementGroupArgs.builder()
            .name("demo")
            .build());

    }
}
Copy
variables:
  group:
    fn::invoke:
      function: ibm:getComputePlacementGroup
      arguments:
        name: demo
Copy

The following example shows how you can use this data source to reference the placement group ID in the ibm.ComputeVmInstance resource because the numeric IDs are often unknown.

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

const vm1 = new ibm.ComputeVmInstance("vm1", {placementGroupId: data.ibm_compute_placement_group.group.id});
Copy
import pulumi
import pulumi_ibm as ibm

vm1 = ibm.ComputeVmInstance("vm1", placement_group_id=data["ibm_compute_placement_group"]["group"]["id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ibm.NewComputeVmInstance(ctx, "vm1", &ibm.ComputeVmInstanceArgs{
			PlacementGroupId: pulumi.Any(data.Ibm_compute_placement_group.Group.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;

return await Deployment.RunAsync(() => 
{
    var vm1 = new Ibm.ComputeVmInstance("vm1", new()
    {
        PlacementGroupId = data.Ibm_compute_placement_group.Group.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.ComputeVmInstance;
import com.pulumi.ibm.ComputeVmInstanceArgs;
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 vm1 = new ComputeVmInstance("vm1", ComputeVmInstanceArgs.builder()
            .placementGroupId(data.ibm_compute_placement_group().group().id())
            .build());

    }
}
Copy
resources:
  vm1:
    type: ibm:ComputeVmInstance
    properties:
      placementGroupId: ${data.ibm_compute_placement_group.group.id}
Copy

Using getComputePlacementGroup

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 getComputePlacementGroup(args: GetComputePlacementGroupArgs, opts?: InvokeOptions): Promise<GetComputePlacementGroupResult>
function getComputePlacementGroupOutput(args: GetComputePlacementGroupOutputArgs, opts?: InvokeOptions): Output<GetComputePlacementGroupResult>
Copy
def get_compute_placement_group(id: Optional[str] = None,
                                name: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetComputePlacementGroupResult
def get_compute_placement_group_output(id: Optional[pulumi.Input[str]] = None,
                                name: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetComputePlacementGroupResult]
Copy
func LookupComputePlacementGroup(ctx *Context, args *LookupComputePlacementGroupArgs, opts ...InvokeOption) (*LookupComputePlacementGroupResult, error)
func LookupComputePlacementGroupOutput(ctx *Context, args *LookupComputePlacementGroupOutputArgs, opts ...InvokeOption) LookupComputePlacementGroupResultOutput
Copy

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

public static class GetComputePlacementGroup 
{
    public static Task<GetComputePlacementGroupResult> InvokeAsync(GetComputePlacementGroupArgs args, InvokeOptions? opts = null)
    public static Output<GetComputePlacementGroupResult> Invoke(GetComputePlacementGroupInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetComputePlacementGroupResult> getComputePlacementGroup(GetComputePlacementGroupArgs args, InvokeOptions options)
public static Output<GetComputePlacementGroupResult> getComputePlacementGroup(GetComputePlacementGroupArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: ibm:index/getComputePlacementGroup:getComputePlacementGroup
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the placement group.
Id string
(String) The ID of the virtual guest.
Name This property is required. string
The name of the placement group.
Id string
(String) The ID of the virtual guest.
name This property is required. String
The name of the placement group.
id String
(String) The ID of the virtual guest.
name This property is required. string
The name of the placement group.
id string
(String) The ID of the virtual guest.
name This property is required. str
The name of the placement group.
id str
(String) The ID of the virtual guest.
name This property is required. String
The name of the placement group.
id String
(String) The ID of the virtual guest.

getComputePlacementGroup Result

The following output properties are available:

Datacenter string
(String) The data center in which placement group resides.
Id string
(String) The ID of the virtual guest.
Name string
Pod string
(String) The pod in which placement group resides.
Rule string
(String) The rule of the placement group.
VirtualGuests List<GetComputePlacementGroupVirtualGuest>
(List of Objects) A nested block describes the VSIs attached to the placement group.
Datacenter string
(String) The data center in which placement group resides.
Id string
(String) The ID of the virtual guest.
Name string
Pod string
(String) The pod in which placement group resides.
Rule string
(String) The rule of the placement group.
VirtualGuests []GetComputePlacementGroupVirtualGuest
(List of Objects) A nested block describes the VSIs attached to the placement group.
datacenter String
(String) The data center in which placement group resides.
id String
(String) The ID of the virtual guest.
name String
pod String
(String) The pod in which placement group resides.
rule String
(String) The rule of the placement group.
virtualGuests List<GetComputePlacementGroupVirtualGuest>
(List of Objects) A nested block describes the VSIs attached to the placement group.
datacenter string
(String) The data center in which placement group resides.
id string
(String) The ID of the virtual guest.
name string
pod string
(String) The pod in which placement group resides.
rule string
(String) The rule of the placement group.
virtualGuests GetComputePlacementGroupVirtualGuest[]
(List of Objects) A nested block describes the VSIs attached to the placement group.
datacenter str
(String) The data center in which placement group resides.
id str
(String) The ID of the virtual guest.
name str
pod str
(String) The pod in which placement group resides.
rule str
(String) The rule of the placement group.
virtual_guests Sequence[GetComputePlacementGroupVirtualGuest]
(List of Objects) A nested block describes the VSIs attached to the placement group.
datacenter String
(String) The data center in which placement group resides.
id String
(String) The ID of the virtual guest.
name String
pod String
(String) The pod in which placement group resides.
rule String
(String) The rule of the placement group.
virtualGuests List<Property Map>
(List of Objects) A nested block describes the VSIs attached to the placement group.

Supporting Types

GetComputePlacementGroupVirtualGuest

Domain This property is required. string
(String) The domain of the virtual guest.
Hostname This property is required. string
(String) The hostname of the virtual guest.
Id This property is required. double
(String) The ID of the virtual guest.
Domain This property is required. string
(String) The domain of the virtual guest.
Hostname This property is required. string
(String) The hostname of the virtual guest.
Id This property is required. float64
(String) The ID of the virtual guest.
domain This property is required. String
(String) The domain of the virtual guest.
hostname This property is required. String
(String) The hostname of the virtual guest.
id This property is required. Double
(String) The ID of the virtual guest.
domain This property is required. string
(String) The domain of the virtual guest.
hostname This property is required. string
(String) The hostname of the virtual guest.
id This property is required. number
(String) The ID of the virtual guest.
domain This property is required. str
(String) The domain of the virtual guest.
hostname This property is required. str
(String) The hostname of the virtual guest.
id This property is required. float
(String) The ID of the virtual guest.
domain This property is required. String
(String) The domain of the virtual guest.
hostname This property is required. String
(String) The hostname of the virtual guest.
id This property is required. Number
(String) The ID of the virtual guest.

Package Details

Repository
ibm ibm-cloud/terraform-provider-ibm
License
Notes
This Pulumi package is based on the ibm Terraform Provider.