published on Thursday, May 21, 2026 by ibm-cloud
published on Thursday, May 21, 2026 by ibm-cloud
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",
});
import pulumi
import pulumi_ibm as ibm
group = ibm.get_compute_placement_group(name="demo")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/v2/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
})
}
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",
});
});
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());
}
}
variables:
group:
fn::invoke:
function: ibm:getComputePlacementGroup
arguments:
name: demo
Example coming soon!
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: group.id});
import pulumi
import pulumi_ibm as ibm
vm1 = ibm.ComputeVmInstance("vm1", placement_group_id=group["id"])
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/v2/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(group.Id),
})
if err != nil {
return err
}
return nil
})
}
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 = @group.Id,
});
});
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(group.id())
.build());
}
}
resources:
vm1:
type: ibm:ComputeVmInstance
properties:
placementGroupId: ${group.id}
Example coming soon!
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>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: pulumi.Input[Optional[str]] = None,
name: pulumi.Input[Optional[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetComputePlacementGroupResult]func LookupComputePlacementGroup(ctx *Context, args *LookupComputePlacementGroupArgs, opts ...InvokeOption) (*LookupComputePlacementGroupResult, error)
func LookupComputePlacementGroupOutput(ctx *Context, args *LookupComputePlacementGroupOutputArgs, opts ...InvokeOption) LookupComputePlacementGroupResultOutput> 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)
}public static CompletableFuture<GetComputePlacementGroupResult> getComputePlacementGroup(GetComputePlacementGroupArgs args, InvokeOptions options)
public static Output<GetComputePlacementGroupResult> getComputePlacementGroup(GetComputePlacementGroupArgs args, InvokeOptions options)
fn::invoke:
function: ibm:index/getComputePlacementGroup:getComputePlacementGroup
arguments:
# arguments dictionarydata "ibm_getcomputeplacementgroup" "name" {
# arguments
}The following arguments are supported:
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.
- Virtual
Guests List<GetCompute Placement Group Virtual Guest> - (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.
- Virtual
Guests []GetCompute Placement Group Virtual Guest - (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.
- virtual_
guests list(object) - (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.
- virtual
Guests List<GetCompute Placement Group Virtual Guest> - (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.
- virtual
Guests GetCompute Placement Group Virtual Guest[] - (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[GetCompute Placement Group Virtual Guest] - (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.
- virtual
Guests List<Property Map> - (List of Objects) A nested block describes the VSIs attached to the placement group.
Supporting Types
GetComputePlacementGroupVirtualGuest
Package Details
- Repository
- ibm ibm-cloud/terraform-provider-ibm
- License
- Notes
- This Pulumi package is based on the
ibmTerraform Provider.
published on Thursday, May 21, 2026 by ibm-cloud