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

ibm.getComputeVmInstance

Explore with Pulumi AI

Retrieve information of an existing Virtual Machine (VM) instance as a read-only data source. For more information, about computer VM instance, see enabling auto scale for better capacity and resiliency.

Example Usage

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

const vmInstance = ibm.getComputeVmInstance({
    domain: "example.com",
    hostname: "jumpbox",
    mostRecent: true,
});
Copy
import pulumi
import pulumi_ibm as ibm

vm_instance = ibm.get_compute_vm_instance(domain="example.com",
    hostname="jumpbox",
    most_recent=True)
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.LookupComputeVmInstance(ctx, &ibm.LookupComputeVmInstanceArgs{
			Domain:     "example.com",
			Hostname:   "jumpbox",
			MostRecent: pulumi.BoolRef(true),
		}, 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 vmInstance = Ibm.GetComputeVmInstance.Invoke(new()
    {
        Domain = "example.com",
        Hostname = "jumpbox",
        MostRecent = true,
    });

});
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.GetComputeVmInstanceArgs;
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 vmInstance = IbmFunctions.getComputeVmInstance(GetComputeVmInstanceArgs.builder()
            .domain("example.com")
            .hostname("jumpbox")
            .mostRecent(true)
            .build());

    }
}
Copy
variables:
  vmInstance:
    fn::invoke:
      function: ibm:getComputeVmInstance
      arguments:
        domain: example.com
        hostname: jumpbox
        mostRecent: true
Copy

Using getComputeVmInstance

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 getComputeVmInstance(args: GetComputeVmInstanceArgs, opts?: InvokeOptions): Promise<GetComputeVmInstanceResult>
function getComputeVmInstanceOutput(args: GetComputeVmInstanceOutputArgs, opts?: InvokeOptions): Output<GetComputeVmInstanceResult>
Copy
def get_compute_vm_instance(domain: Optional[str] = None,
                            hostname: Optional[str] = None,
                            id: Optional[str] = None,
                            most_recent: Optional[bool] = None,
                            opts: Optional[InvokeOptions] = None) -> GetComputeVmInstanceResult
def get_compute_vm_instance_output(domain: Optional[pulumi.Input[str]] = None,
                            hostname: Optional[pulumi.Input[str]] = None,
                            id: Optional[pulumi.Input[str]] = None,
                            most_recent: Optional[pulumi.Input[bool]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetComputeVmInstanceResult]
Copy
func LookupComputeVmInstance(ctx *Context, args *LookupComputeVmInstanceArgs, opts ...InvokeOption) (*LookupComputeVmInstanceResult, error)
func LookupComputeVmInstanceOutput(ctx *Context, args *LookupComputeVmInstanceOutputArgs, opts ...InvokeOption) LookupComputeVmInstanceResultOutput
Copy

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

public static class GetComputeVmInstance 
{
    public static Task<GetComputeVmInstanceResult> InvokeAsync(GetComputeVmInstanceArgs args, InvokeOptions? opts = null)
    public static Output<GetComputeVmInstanceResult> Invoke(GetComputeVmInstanceInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetComputeVmInstanceResult> getComputeVmInstance(GetComputeVmInstanceArgs args, InvokeOptions options)
public static Output<GetComputeVmInstanceResult> getComputeVmInstance(GetComputeVmInstanceArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: ibm:index/getComputeVmInstance:getComputeVmInstance
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Domain This property is required. string
The domain of the VM instance.
Hostname This property is required. string
The hostname of the VM instance.
Id string
(String) The unique identifier of the VM instance.
MostRecent bool
For multiple VM instances, you can set this argument to true to import only the most recently created instance.
Domain This property is required. string
The domain of the VM instance.
Hostname This property is required. string
The hostname of the VM instance.
Id string
(String) The unique identifier of the VM instance.
MostRecent bool
For multiple VM instances, you can set this argument to true to import only the most recently created instance.
domain This property is required. String
The domain of the VM instance.
hostname This property is required. String
The hostname of the VM instance.
id String
(String) The unique identifier of the VM instance.
mostRecent Boolean
For multiple VM instances, you can set this argument to true to import only the most recently created instance.
domain This property is required. string
The domain of the VM instance.
hostname This property is required. string
The hostname of the VM instance.
id string
(String) The unique identifier of the VM instance.
mostRecent boolean
For multiple VM instances, you can set this argument to true to import only the most recently created instance.
domain This property is required. str
The domain of the VM instance.
hostname This property is required. str
The hostname of the VM instance.
id str
(String) The unique identifier of the VM instance.
most_recent bool
For multiple VM instances, you can set this argument to true to import only the most recently created instance.
domain This property is required. String
The domain of the VM instance.
hostname This property is required. String
The hostname of the VM instance.
id String
(String) The unique identifier of the VM instance.
mostRecent Boolean
For multiple VM instances, you can set this argument to true to import only the most recently created instance.

getComputeVmInstance Result

The following output properties are available:

Cores double
(Integer) The number of CPU cores.
Datacenter string
(String) The data center in which the VM instance is deployed.
Domain string
Hostname string
Id string
(String) The unique identifier of the VM instance.
IpAddressId double
(String) The unique identifier for the public IPv4 address that is assigned to the VM instance.
IpAddressIdPrivate double
(String) The unique identifier for the private IPv4 address that is assigned to the VM instance.
Ipv4Address string
(String) The public IPv4 address of the VM instance.
Ipv4AddressPrivate string
(String) The private IPv4 address of the VM instance.
Ipv6Address string
(String) The public IPv6 address of the VM instance provided when ipv6_enabled is set to true.
Ipv6AddressId double
(String) The unique identifier for the public IPv6 address assigned to the VM instance provided when ipv6_enabled is set to true.
LastKnownPowerState string
(String) The last known power state of a VM instance, if the instance is turned off outside the information management system (IMS) is offline.
PowerState string
(String) The current power state of a VM instance.
PrivateInterfaceId double
(String) The ID of the primary private interface.
PrivateSubnetId double
(String) The unique identifier of the subnet ipv4_address_private belongs to.
PublicInterfaceId double
(String) The ID of the primary public interface.
PublicIpv6Subnet string
(String) The public IPv6 subnet provided when ipv6_enabled is set to true.
PublicIpv6SubnetId string
(String) The unique identifier of the subnet ipv6_address belongs to.
PublicSubnetId double
(String) The unique identifier of the subnet ipv4_address belongs to.
SecondaryIpAddresses List<string>
(String) The public secondary IPv4 addresses of the VM instance.
SecondaryIpCount double
(Integer) Number of secondary public IPv4 addresses.
Status string
(String) The VSI status.
MostRecent bool
Cores float64
(Integer) The number of CPU cores.
Datacenter string
(String) The data center in which the VM instance is deployed.
Domain string
Hostname string
Id string
(String) The unique identifier of the VM instance.
IpAddressId float64
(String) The unique identifier for the public IPv4 address that is assigned to the VM instance.
IpAddressIdPrivate float64
(String) The unique identifier for the private IPv4 address that is assigned to the VM instance.
Ipv4Address string
(String) The public IPv4 address of the VM instance.
Ipv4AddressPrivate string
(String) The private IPv4 address of the VM instance.
Ipv6Address string
(String) The public IPv6 address of the VM instance provided when ipv6_enabled is set to true.
Ipv6AddressId float64
(String) The unique identifier for the public IPv6 address assigned to the VM instance provided when ipv6_enabled is set to true.
LastKnownPowerState string
(String) The last known power state of a VM instance, if the instance is turned off outside the information management system (IMS) is offline.
PowerState string
(String) The current power state of a VM instance.
PrivateInterfaceId float64
(String) The ID of the primary private interface.
PrivateSubnetId float64
(String) The unique identifier of the subnet ipv4_address_private belongs to.
PublicInterfaceId float64
(String) The ID of the primary public interface.
PublicIpv6Subnet string
(String) The public IPv6 subnet provided when ipv6_enabled is set to true.
PublicIpv6SubnetId string
(String) The unique identifier of the subnet ipv6_address belongs to.
PublicSubnetId float64
(String) The unique identifier of the subnet ipv4_address belongs to.
SecondaryIpAddresses []string
(String) The public secondary IPv4 addresses of the VM instance.
SecondaryIpCount float64
(Integer) Number of secondary public IPv4 addresses.
Status string
(String) The VSI status.
MostRecent bool
cores Double
(Integer) The number of CPU cores.
datacenter String
(String) The data center in which the VM instance is deployed.
domain String
hostname String
id String
(String) The unique identifier of the VM instance.
ipAddressId Double
(String) The unique identifier for the public IPv4 address that is assigned to the VM instance.
ipAddressIdPrivate Double
(String) The unique identifier for the private IPv4 address that is assigned to the VM instance.
ipv4Address String
(String) The public IPv4 address of the VM instance.
ipv4AddressPrivate String
(String) The private IPv4 address of the VM instance.
ipv6Address String
(String) The public IPv6 address of the VM instance provided when ipv6_enabled is set to true.
ipv6AddressId Double
(String) The unique identifier for the public IPv6 address assigned to the VM instance provided when ipv6_enabled is set to true.
lastKnownPowerState String
(String) The last known power state of a VM instance, if the instance is turned off outside the information management system (IMS) is offline.
powerState String
(String) The current power state of a VM instance.
privateInterfaceId Double
(String) The ID of the primary private interface.
privateSubnetId Double
(String) The unique identifier of the subnet ipv4_address_private belongs to.
publicInterfaceId Double
(String) The ID of the primary public interface.
publicIpv6Subnet String
(String) The public IPv6 subnet provided when ipv6_enabled is set to true.
publicIpv6SubnetId String
(String) The unique identifier of the subnet ipv6_address belongs to.
publicSubnetId Double
(String) The unique identifier of the subnet ipv4_address belongs to.
secondaryIpAddresses List<String>
(String) The public secondary IPv4 addresses of the VM instance.
secondaryIpCount Double
(Integer) Number of secondary public IPv4 addresses.
status String
(String) The VSI status.
mostRecent Boolean
cores number
(Integer) The number of CPU cores.
datacenter string
(String) The data center in which the VM instance is deployed.
domain string
hostname string
id string
(String) The unique identifier of the VM instance.
ipAddressId number
(String) The unique identifier for the public IPv4 address that is assigned to the VM instance.
ipAddressIdPrivate number
(String) The unique identifier for the private IPv4 address that is assigned to the VM instance.
ipv4Address string
(String) The public IPv4 address of the VM instance.
ipv4AddressPrivate string
(String) The private IPv4 address of the VM instance.
ipv6Address string
(String) The public IPv6 address of the VM instance provided when ipv6_enabled is set to true.
ipv6AddressId number
(String) The unique identifier for the public IPv6 address assigned to the VM instance provided when ipv6_enabled is set to true.
lastKnownPowerState string
(String) The last known power state of a VM instance, if the instance is turned off outside the information management system (IMS) is offline.
powerState string
(String) The current power state of a VM instance.
privateInterfaceId number
(String) The ID of the primary private interface.
privateSubnetId number
(String) The unique identifier of the subnet ipv4_address_private belongs to.
publicInterfaceId number
(String) The ID of the primary public interface.
publicIpv6Subnet string
(String) The public IPv6 subnet provided when ipv6_enabled is set to true.
publicIpv6SubnetId string
(String) The unique identifier of the subnet ipv6_address belongs to.
publicSubnetId number
(String) The unique identifier of the subnet ipv4_address belongs to.
secondaryIpAddresses string[]
(String) The public secondary IPv4 addresses of the VM instance.
secondaryIpCount number
(Integer) Number of secondary public IPv4 addresses.
status string
(String) The VSI status.
mostRecent boolean
cores float
(Integer) The number of CPU cores.
datacenter str
(String) The data center in which the VM instance is deployed.
domain str
hostname str
id str
(String) The unique identifier of the VM instance.
ip_address_id float
(String) The unique identifier for the public IPv4 address that is assigned to the VM instance.
ip_address_id_private float
(String) The unique identifier for the private IPv4 address that is assigned to the VM instance.
ipv4_address str
(String) The public IPv4 address of the VM instance.
ipv4_address_private str
(String) The private IPv4 address of the VM instance.
ipv6_address str
(String) The public IPv6 address of the VM instance provided when ipv6_enabled is set to true.
ipv6_address_id float
(String) The unique identifier for the public IPv6 address assigned to the VM instance provided when ipv6_enabled is set to true.
last_known_power_state str
(String) The last known power state of a VM instance, if the instance is turned off outside the information management system (IMS) is offline.
power_state str
(String) The current power state of a VM instance.
private_interface_id float
(String) The ID of the primary private interface.
private_subnet_id float
(String) The unique identifier of the subnet ipv4_address_private belongs to.
public_interface_id float
(String) The ID of the primary public interface.
public_ipv6_subnet str
(String) The public IPv6 subnet provided when ipv6_enabled is set to true.
public_ipv6_subnet_id str
(String) The unique identifier of the subnet ipv6_address belongs to.
public_subnet_id float
(String) The unique identifier of the subnet ipv4_address belongs to.
secondary_ip_addresses Sequence[str]
(String) The public secondary IPv4 addresses of the VM instance.
secondary_ip_count float
(Integer) Number of secondary public IPv4 addresses.
status str
(String) The VSI status.
most_recent bool
cores Number
(Integer) The number of CPU cores.
datacenter String
(String) The data center in which the VM instance is deployed.
domain String
hostname String
id String
(String) The unique identifier of the VM instance.
ipAddressId Number
(String) The unique identifier for the public IPv4 address that is assigned to the VM instance.
ipAddressIdPrivate Number
(String) The unique identifier for the private IPv4 address that is assigned to the VM instance.
ipv4Address String
(String) The public IPv4 address of the VM instance.
ipv4AddressPrivate String
(String) The private IPv4 address of the VM instance.
ipv6Address String
(String) The public IPv6 address of the VM instance provided when ipv6_enabled is set to true.
ipv6AddressId Number
(String) The unique identifier for the public IPv6 address assigned to the VM instance provided when ipv6_enabled is set to true.
lastKnownPowerState String
(String) The last known power state of a VM instance, if the instance is turned off outside the information management system (IMS) is offline.
powerState String
(String) The current power state of a VM instance.
privateInterfaceId Number
(String) The ID of the primary private interface.
privateSubnetId Number
(String) The unique identifier of the subnet ipv4_address_private belongs to.
publicInterfaceId Number
(String) The ID of the primary public interface.
publicIpv6Subnet String
(String) The public IPv6 subnet provided when ipv6_enabled is set to true.
publicIpv6SubnetId String
(String) The unique identifier of the subnet ipv6_address belongs to.
publicSubnetId Number
(String) The unique identifier of the subnet ipv4_address belongs to.
secondaryIpAddresses List<String>
(String) The public secondary IPv4 addresses of the VM instance.
secondaryIpCount Number
(Integer) Number of secondary public IPv4 addresses.
status String
(String) The VSI status.
mostRecent Boolean

Package Details

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