1. Packages
  2. Ibm Provider
  3. API Docs
  4. getComputePlacementGroup
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.getComputePlacementGroup

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 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/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
    

    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});
    
    import pulumi
    import pulumi_ibm as ibm
    
    vm1 = ibm.ComputeVmInstance("vm1", placement_group_id=data["ibm_compute_placement_group"]["group"]["id"])
    
    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
    	})
    }
    
    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,
        });
    
    });
    
    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());
    
        }
    }
    
    resources:
      vm1:
        type: ibm:ComputeVmInstance
        properties:
          placementGroupId: ${data.ibm_compute_placement_group.group.id}
    

    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: Optional[pulumi.Input[str]] = None,
                                    name: Optional[pulumi.Input[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 dictionary

    The following arguments are supported:

    Name string
    The name of the placement group.
    Id string
    (String) The ID of the virtual guest.
    Name string
    The name of the placement group.
    Id string
    (String) The ID of the virtual guest.
    name String
    The name of the placement group.
    id String
    (String) The ID of the virtual guest.
    name string
    The name of the placement group.
    id string
    (String) The ID of the virtual guest.
    name str
    The name of the placement group.
    id str
    (String) The ID of the virtual guest.
    name 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 string
    (String) The domain of the virtual guest.
    Hostname string
    (String) The hostname of the virtual guest.
    Id double
    (String) The ID of the virtual guest.
    Domain string
    (String) The domain of the virtual guest.
    Hostname string
    (String) The hostname of the virtual guest.
    Id float64
    (String) The ID of the virtual guest.
    domain String
    (String) The domain of the virtual guest.
    hostname String
    (String) The hostname of the virtual guest.
    id Double
    (String) The ID of the virtual guest.
    domain string
    (String) The domain of the virtual guest.
    hostname string
    (String) The hostname of the virtual guest.
    id number
    (String) The ID of the virtual guest.
    domain str
    (String) The domain of the virtual guest.
    hostname str
    (String) The hostname of the virtual guest.
    id float
    (String) The ID of the virtual guest.
    domain String
    (String) The domain of the virtual guest.
    hostname String
    (String) The hostname of the virtual guest.
    id 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.
    ibm logo
    ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud