ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud
ibm.getComputeReservedCapacity
Explore with Pulumi AI
Retrieve information of an existing reserved group as a read-only data source.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
const reservedcapacityds = ibm.getComputeReservedCapacity({
mostRecent: true,
name: "reservedgroup",
});
import pulumi
import pulumi_ibm as ibm
reservedcapacityds = ibm.get_compute_reserved_capacity(most_recent=True,
name="reservedgroup")
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.LookupComputeReservedCapacity(ctx, &ibm.LookupComputeReservedCapacityArgs{
MostRecent: pulumi.BoolRef(true),
Name: "reservedgroup",
}, 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 reservedcapacityds = Ibm.GetComputeReservedCapacity.Invoke(new()
{
MostRecent = true,
Name = "reservedgroup",
});
});
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.GetComputeReservedCapacityArgs;
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 reservedcapacityds = IbmFunctions.getComputeReservedCapacity(GetComputeReservedCapacityArgs.builder()
.mostRecent(true)
.name("reservedgroup")
.build());
}
}
variables:
reservedcapacityds:
fn::invoke:
function: ibm:getComputeReservedCapacity
arguments:
mostRecent: true
name: reservedgroup
The following example shows how you can use this data source to reference the reserved 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", {reservedCapacityId: data.ibm_compute_placement_group.group.id});
import pulumi
import pulumi_ibm as ibm
vm1 = ibm.ComputeVmInstance("vm1", reserved_capacity_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{
ReservedCapacityId: 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()
{
ReservedCapacityId = 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()
.reservedCapacityId(data.ibm_compute_placement_group().group().id())
.build());
}
}
resources:
vm1:
type: ibm:ComputeVmInstance
properties:
reservedCapacityId: ${data.ibm_compute_placement_group.group.id}
Using getComputeReservedCapacity
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 getComputeReservedCapacity(args: GetComputeReservedCapacityArgs, opts?: InvokeOptions): Promise<GetComputeReservedCapacityResult>
function getComputeReservedCapacityOutput(args: GetComputeReservedCapacityOutputArgs, opts?: InvokeOptions): Output<GetComputeReservedCapacityResult>
def get_compute_reserved_capacity(id: Optional[str] = None,
most_recent: Optional[bool] = None,
name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetComputeReservedCapacityResult
def get_compute_reserved_capacity_output(id: Optional[pulumi.Input[str]] = None,
most_recent: Optional[pulumi.Input[bool]] = None,
name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetComputeReservedCapacityResult]
func LookupComputeReservedCapacity(ctx *Context, args *LookupComputeReservedCapacityArgs, opts ...InvokeOption) (*LookupComputeReservedCapacityResult, error)
func LookupComputeReservedCapacityOutput(ctx *Context, args *LookupComputeReservedCapacityOutputArgs, opts ...InvokeOption) LookupComputeReservedCapacityResultOutput
> Note: This function is named LookupComputeReservedCapacity
in the Go SDK.
public static class GetComputeReservedCapacity
{
public static Task<GetComputeReservedCapacityResult> InvokeAsync(GetComputeReservedCapacityArgs args, InvokeOptions? opts = null)
public static Output<GetComputeReservedCapacityResult> Invoke(GetComputeReservedCapacityInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetComputeReservedCapacityResult> getComputeReservedCapacity(GetComputeReservedCapacityArgs args, InvokeOptions options)
public static Output<GetComputeReservedCapacityResult> getComputeReservedCapacity(GetComputeReservedCapacityArgs args, InvokeOptions options)
fn::invoke:
function: ibm:index/getComputeReservedCapacity:getComputeReservedCapacity
arguments:
# arguments dictionary
The following arguments are supported:
- Name string
- The name of the reserved capacity.
- Id string
- (String) The ID of the virtual guest.
- Most
Recent bool - For multiple VM instances, you can set this argument to true to import only the most recently created instance.
- Name string
- The name of the reserved capacity.
- Id string
- (String) The ID of the virtual guest.
- Most
Recent bool - For multiple VM instances, you can set this argument to true to import only the most recently created instance.
- name String
- The name of the reserved capacity.
- id String
- (String) The ID of the virtual guest.
- most
Recent Boolean - For multiple VM instances, you can set this argument to true to import only the most recently created instance.
- name string
- The name of the reserved capacity.
- id string
- (String) The ID of the virtual guest.
- most
Recent boolean - For multiple VM instances, you can set this argument to true to import only the most recently created instance.
- name str
- The name of the reserved capacity.
- id str
- (String) The ID of the virtual guest.
- most_
recent bool - For multiple VM instances, you can set this argument to true to import only the most recently created instance.
- name String
- The name of the reserved capacity.
- id String
- (String) The ID of the virtual guest.
- most
Recent Boolean - For multiple VM instances, you can set this argument to true to import only the most recently created instance.
getComputeReservedCapacity Result
The following output properties are available:
- Datacenter string
- (String) The data center in which reserved capacity resides.
- Flavor string
- Id string
- (String) The ID of the virtual guest.
- Instances double
- (int) Number of VSI instances this capacity reservation can support.
- Name string
- Pod string
- (String) The pod in which reserved capacity resides.
- Virtual
Guests List<GetCompute Reserved Capacity Virtual Guest> - (List of Objects) A nested block describes the VSIs attached to the reserved capacity.
- Most
Recent bool
- Datacenter string
- (String) The data center in which reserved capacity resides.
- Flavor string
- Id string
- (String) The ID of the virtual guest.
- Instances float64
- (int) Number of VSI instances this capacity reservation can support.
- Name string
- Pod string
- (String) The pod in which reserved capacity resides.
- Virtual
Guests []GetCompute Reserved Capacity Virtual Guest - (List of Objects) A nested block describes the VSIs attached to the reserved capacity.
- Most
Recent bool
- datacenter String
- (String) The data center in which reserved capacity resides.
- flavor String
- id String
- (String) The ID of the virtual guest.
- instances Double
- (int) Number of VSI instances this capacity reservation can support.
- name String
- pod String
- (String) The pod in which reserved capacity resides.
- virtual
Guests List<GetCompute Reserved Capacity Virtual Guest> - (List of Objects) A nested block describes the VSIs attached to the reserved capacity.
- most
Recent Boolean
- datacenter string
- (String) The data center in which reserved capacity resides.
- flavor string
- id string
- (String) The ID of the virtual guest.
- instances number
- (int) Number of VSI instances this capacity reservation can support.
- name string
- pod string
- (String) The pod in which reserved capacity resides.
- virtual
Guests GetCompute Reserved Capacity Virtual Guest[] - (List of Objects) A nested block describes the VSIs attached to the reserved capacity.
- most
Recent boolean
- datacenter str
- (String) The data center in which reserved capacity resides.
- flavor str
- id str
- (String) The ID of the virtual guest.
- instances float
- (int) Number of VSI instances this capacity reservation can support.
- name str
- pod str
- (String) The pod in which reserved capacity resides.
- virtual_
guests Sequence[GetCompute Reserved Capacity Virtual Guest] - (List of Objects) A nested block describes the VSIs attached to the reserved capacity.
- most_
recent bool
- datacenter String
- (String) The data center in which reserved capacity resides.
- flavor String
- id String
- (String) The ID of the virtual guest.
- instances Number
- (int) Number of VSI instances this capacity reservation can support.
- name String
- pod String
- (String) The pod in which reserved capacity resides.
- virtual
Guests List<Property Map> - (List of Objects) A nested block describes the VSIs attached to the reserved capacity.
- most
Recent Boolean
Supporting Types
GetComputeReservedCapacityVirtualGuest
Package Details
- Repository
- ibm ibm-cloud/terraform-provider-ibm
- License
- Notes
- This Pulumi package is based on the
ibm
Terraform Provider.