GetInstance

Get information about a VM instance resource within GCE. For more information see the official documentation and API.

Using GetInstance

function getInstance(args: GetInstanceArgs, opts?: InvokeOptions): Promise<GetInstanceResult>
function  get_instance(name=None, project=None, self_link=None, zone=None, opts=None)
func LookupInstance(ctx *Context, args *LookupInstanceArgs, opts ...InvokeOption) (*LookupInstanceResult, error)

Note: This function is named LookupInstance in the Go SDK.

public static class GetInstance {
    public static Task<GetInstanceResult> InvokeAsync(GetInstanceArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string

The name of the instance. One of name or self_link must be provided.

Project string

The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.

SelfLink string

The self link of the instance. One of name or self_link must be provided.

Zone string

The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.

Name string

The name of the instance. One of name or self_link must be provided.

Project string

The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.

SelfLink string

The self link of the instance. One of name or self_link must be provided.

Zone string

The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.

name string

The name of the instance. One of name or self_link must be provided.

project string

The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.

selfLink string

The self link of the instance. One of name or self_link must be provided.

zone string

The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.

name str

The name of the instance. One of name or self_link must be provided.

project str

The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.

self_link str

The self link of the instance. One of name or self_link must be provided.

zone str

The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.

GetInstance Result

The following output properties are available:

AllowStoppingForUpdate bool
AttachedDisks List<GetInstanceAttachedDisk>

List of disks attached to the instance. Structure is documented below.

BootDisks List<GetInstanceBootDisk>

The boot disk for the instance. Structure is documented below.

CanIpForward bool

Whether sending and receiving of packets with non-matching source or destination IPs is allowed.

CpuPlatform string

The CPU platform used by this instance.

CurrentStatus string
DeletionProtection bool

Whether deletion protection is enabled on this instance.

Description string

A brief description of the resource.

DesiredStatus string
EnableDisplay bool
GuestAccelerators List<GetInstanceGuestAccelerator>

List of the type and count of accelerator cards attached to the instance. Structure is documented below.

Hostname string
Id string

The provider-assigned unique ID for this managed resource.

InstanceId string

The server-assigned unique identifier of this instance.

LabelFingerprint string

The unique fingerprint of the labels.

Labels Dictionary<string, string>

A set of key/value label pairs assigned to the instance.

MachineType string

The machine type to create.

Metadata Dictionary<string, string>

Metadata key/value pairs made available within the instance.

MetadataFingerprint string

The unique fingerprint of the metadata.

MetadataStartupScript string
MinCpuPlatform string

The minimum CPU platform specified for the VM instance.

NetworkInterfaces List<GetInstanceNetworkInterface>

The networks attached to the instance. Structure is documented below.

ResourcePolicies List<string>
Schedulings List<GetInstanceScheduling>

The scheduling strategy being used by the instance.

ScratchDisks List<GetInstanceScratchDisk>

The scratch disks attached to the instance. Structure is documented below.

ServiceAccounts List<GetInstanceServiceAccount>

The service account to attach to the instance. Structure is documented below.

ShieldedInstanceConfigs List<GetInstanceShieldedInstanceConfig>

The shielded vm config being used by the instance. Structure is documented below.

Tags List<string>

The list of tags attached to the instance.

TagsFingerprint string

The unique fingerprint of the tags.

Name string
Project string
SelfLink string

The URI of the created resource.

Zone string
AllowStoppingForUpdate bool
AttachedDisks []GetInstanceAttachedDisk

List of disks attached to the instance. Structure is documented below.

BootDisks []GetInstanceBootDisk

The boot disk for the instance. Structure is documented below.

CanIpForward bool

Whether sending and receiving of packets with non-matching source or destination IPs is allowed.

CpuPlatform string

The CPU platform used by this instance.

CurrentStatus string
DeletionProtection bool

Whether deletion protection is enabled on this instance.

Description string

A brief description of the resource.

DesiredStatus string
EnableDisplay bool
GuestAccelerators []GetInstanceGuestAccelerator

List of the type and count of accelerator cards attached to the instance. Structure is documented below.

Hostname string
Id string

The provider-assigned unique ID for this managed resource.

InstanceId string

The server-assigned unique identifier of this instance.

LabelFingerprint string

The unique fingerprint of the labels.

Labels map[string]string

A set of key/value label pairs assigned to the instance.

MachineType string

The machine type to create.

Metadata map[string]string

Metadata key/value pairs made available within the instance.

MetadataFingerprint string

The unique fingerprint of the metadata.

MetadataStartupScript string
MinCpuPlatform string

The minimum CPU platform specified for the VM instance.

NetworkInterfaces []GetInstanceNetworkInterface

The networks attached to the instance. Structure is documented below.

ResourcePolicies []string
Schedulings []GetInstanceScheduling

The scheduling strategy being used by the instance.

ScratchDisks []GetInstanceScratchDisk

The scratch disks attached to the instance. Structure is documented below.

ServiceAccounts []GetInstanceServiceAccount

The service account to attach to the instance. Structure is documented below.

ShieldedInstanceConfigs []GetInstanceShieldedInstanceConfig

The shielded vm config being used by the instance. Structure is documented below.

Tags []string

The list of tags attached to the instance.

TagsFingerprint string

The unique fingerprint of the tags.

Name string
Project string
SelfLink string

The URI of the created resource.

Zone string
allowStoppingForUpdate boolean
attachedDisks GetInstanceAttachedDisk[]

List of disks attached to the instance. Structure is documented below.

bootDisks GetInstanceBootDisk[]

The boot disk for the instance. Structure is documented below.

canIpForward boolean

Whether sending and receiving of packets with non-matching source or destination IPs is allowed.

cpuPlatform string

The CPU platform used by this instance.

currentStatus string
deletionProtection boolean

Whether deletion protection is enabled on this instance.

description string

A brief description of the resource.

desiredStatus string
enableDisplay boolean
guestAccelerators GetInstanceGuestAccelerator[]

List of the type and count of accelerator cards attached to the instance. Structure is documented below.

hostname string
id string

The provider-assigned unique ID for this managed resource.

instanceId string

The server-assigned unique identifier of this instance.

labelFingerprint string

The unique fingerprint of the labels.

labels {[key: string]: string}

A set of key/value label pairs assigned to the instance.

machineType string

The machine type to create.

metadata {[key: string]: string}

Metadata key/value pairs made available within the instance.

metadataFingerprint string

The unique fingerprint of the metadata.

metadataStartupScript string
minCpuPlatform string

The minimum CPU platform specified for the VM instance.

networkInterfaces GetInstanceNetworkInterface[]

The networks attached to the instance. Structure is documented below.

resourcePolicies string[]
schedulings GetInstanceScheduling[]

The scheduling strategy being used by the instance.

scratchDisks GetInstanceScratchDisk[]

The scratch disks attached to the instance. Structure is documented below.

serviceAccounts GetInstanceServiceAccount[]

The service account to attach to the instance. Structure is documented below.

shieldedInstanceConfigs GetInstanceShieldedInstanceConfig[]

The shielded vm config being used by the instance. Structure is documented below.

tags string[]

The list of tags attached to the instance.

tagsFingerprint string

The unique fingerprint of the tags.

name string
project string
selfLink string

The URI of the created resource.

zone string
allow_stopping_for_update bool
attached_disks List[GetInstanceAttachedDisk]

List of disks attached to the instance. Structure is documented below.

boot_disks List[GetInstanceBootDisk]

The boot disk for the instance. Structure is documented below.

can_ip_forward bool

Whether sending and receiving of packets with non-matching source or destination IPs is allowed.

cpu_platform str

The CPU platform used by this instance.

current_status str
deletion_protection bool

Whether deletion protection is enabled on this instance.

description str

A brief description of the resource.

desired_status str
enable_display bool
guest_accelerators List[GetInstanceGuestAccelerator]

List of the type and count of accelerator cards attached to the instance. Structure is documented below.

hostname str
id str

The provider-assigned unique ID for this managed resource.

instance_id str

The server-assigned unique identifier of this instance.

label_fingerprint str

The unique fingerprint of the labels.

labels Dict[str, str]

A set of key/value label pairs assigned to the instance.

machine_type str

The machine type to create.

metadata Dict[str, str]

Metadata key/value pairs made available within the instance.

metadata_fingerprint str

The unique fingerprint of the metadata.

metadata_startup_script str
min_cpu_platform str

The minimum CPU platform specified for the VM instance.

network_interfaces List[GetInstanceNetworkInterface]

The networks attached to the instance. Structure is documented below.

resource_policies List[str]
schedulings List[GetInstanceScheduling]

The scheduling strategy being used by the instance.

scratch_disks List[GetInstanceScratchDisk]

The scratch disks attached to the instance. Structure is documented below.

service_accounts List[GetInstanceServiceAccount]

The service account to attach to the instance. Structure is documented below.

shielded_instance_configs List[GetInstanceShieldedInstanceConfig]

The shielded vm config being used by the instance. Structure is documented below.

tags List[str]

The list of tags attached to the instance.

tags_fingerprint str

The unique fingerprint of the tags.

name str
project str
self_link str

The URI of the created resource.

zone str

Supporting Types

GetInstanceAttachedDisk

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

DeviceName string

Name with which the attached disk is accessible under /dev/disk/by-id/

DiskEncryptionKeyRaw string
DiskEncryptionKeySha256 string
KmsKeySelfLink string
Mode string

Read/write mode for the disk. One of "READ_ONLY" or "READ_WRITE".

Source string

The name or self_link of the disk attached to this instance.

DeviceName string

Name with which the attached disk is accessible under /dev/disk/by-id/

DiskEncryptionKeyRaw string
DiskEncryptionKeySha256 string
KmsKeySelfLink string
Mode string

Read/write mode for the disk. One of "READ_ONLY" or "READ_WRITE".

Source string

The name or self_link of the disk attached to this instance.

deviceName string

Name with which the attached disk is accessible under /dev/disk/by-id/

diskEncryptionKeyRaw string
diskEncryptionKeySha256 string
kmsKeySelfLink string
mode string

Read/write mode for the disk. One of "READ_ONLY" or "READ_WRITE".

source string

The name or self_link of the disk attached to this instance.

device_name str

Name with which the attached disk is accessible under /dev/disk/by-id/

diskEncryptionKeyRaw str
diskEncryptionKeySha256 str
kmsKeySelfLink str
mode str

Read/write mode for the disk. One of "READ_ONLY" or "READ_WRITE".

source str

The name or self_link of the disk attached to this instance.

GetInstanceBootDisk

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

AutoDelete bool

Whether the disk will be auto-deleted when the instance is deleted.

DeviceName string

Name with which the attached disk is accessible under /dev/disk/by-id/

DiskEncryptionKeyRaw string
DiskEncryptionKeySha256 string
InitializeParams List<GetInstanceBootDiskInitializeParamArgs>

Parameters with which a disk was created alongside the instance. Structure is documented below.

KmsKeySelfLink string
Mode string

Read/write mode for the disk. One of "READ_ONLY" or "READ_WRITE".

Source string

The name or self_link of the disk attached to this instance.

AutoDelete bool

Whether the disk will be auto-deleted when the instance is deleted.

DeviceName string

Name with which the attached disk is accessible under /dev/disk/by-id/

DiskEncryptionKeyRaw string
DiskEncryptionKeySha256 string
InitializeParams []GetInstanceBootDiskInitializeParam

Parameters with which a disk was created alongside the instance. Structure is documented below.

KmsKeySelfLink string
Mode string

Read/write mode for the disk. One of "READ_ONLY" or "READ_WRITE".

Source string

The name or self_link of the disk attached to this instance.

autoDelete boolean

Whether the disk will be auto-deleted when the instance is deleted.

deviceName string

Name with which the attached disk is accessible under /dev/disk/by-id/

diskEncryptionKeyRaw string
diskEncryptionKeySha256 string
initializeParams GetInstanceBootDiskInitializeParam[]

Parameters with which a disk was created alongside the instance. Structure is documented below.

kmsKeySelfLink string
mode string

Read/write mode for the disk. One of "READ_ONLY" or "READ_WRITE".

source string

The name or self_link of the disk attached to this instance.

autoDelete bool

Whether the disk will be auto-deleted when the instance is deleted.

device_name str

Name with which the attached disk is accessible under /dev/disk/by-id/

diskEncryptionKeyRaw str
diskEncryptionKeySha256 str
initializeParams List[GetInstanceBootDiskInitializeParam]

Parameters with which a disk was created alongside the instance. Structure is documented below.

kmsKeySelfLink str
mode str

Read/write mode for the disk. One of "READ_ONLY" or "READ_WRITE".

source str

The name or self_link of the disk attached to this instance.

GetInstanceBootDiskInitializeParam

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Image string

The image from which this disk was initialised.

Labels Dictionary<string, object>

A set of key/value label pairs assigned to the instance.

Size int

The size of the image in gigabytes.

Type string

The accelerator type resource exposed to this instance. E.g. nvidia-tesla-k80.

Image string

The image from which this disk was initialised.

Labels map[string]interface{}

A set of key/value label pairs assigned to the instance.

Size int

The size of the image in gigabytes.

Type string

The accelerator type resource exposed to this instance. E.g. nvidia-tesla-k80.

image string

The image from which this disk was initialised.

labels {[key: string]: any}

A set of key/value label pairs assigned to the instance.

size number

The size of the image in gigabytes.

type string

The accelerator type resource exposed to this instance. E.g. nvidia-tesla-k80.

image str

The image from which this disk was initialised.

labels Dict[str, Any]

A set of key/value label pairs assigned to the instance.

size float

The size of the image in gigabytes.

type str

The accelerator type resource exposed to this instance. E.g. nvidia-tesla-k80.

GetInstanceGuestAccelerator

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Count int

The number of the guest accelerator cards exposed to this instance.

Type string

The accelerator type resource exposed to this instance. E.g. nvidia-tesla-k80.

Count int

The number of the guest accelerator cards exposed to this instance.

Type string

The accelerator type resource exposed to this instance. E.g. nvidia-tesla-k80.

count number

The number of the guest accelerator cards exposed to this instance.

type string

The accelerator type resource exposed to this instance. E.g. nvidia-tesla-k80.

count float

The number of the guest accelerator cards exposed to this instance.

type str

The accelerator type resource exposed to this instance. E.g. nvidia-tesla-k80.

GetInstanceNetworkInterface

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

AccessConfigs List<GetInstanceNetworkInterfaceAccessConfigArgs>

Access configurations, i.e. IPs via which this instance can be accessed via the Internet. Structure documented below.

AliasIpRanges List<GetInstanceNetworkInterfaceAliasIpRangeArgs>

An array of alias IP ranges for this network interface. Structure documented below.

Name string

The name of the instance. One of name or self_link must be provided.

Network string

The name or self_link of the network attached to this interface.

NetworkIp string

The private IP address assigned to the instance.

Subnetwork string

The name or self_link of the subnetwork attached to this interface.

SubnetworkProject string

The project in which the subnetwork belongs.

AccessConfigs []GetInstanceNetworkInterfaceAccessConfig

Access configurations, i.e. IPs via which this instance can be accessed via the Internet. Structure documented below.

AliasIpRanges []GetInstanceNetworkInterfaceAliasIpRange

An array of alias IP ranges for this network interface. Structure documented below.

Name string

The name of the instance. One of name or self_link must be provided.

Network string

The name or self_link of the network attached to this interface.

NetworkIp string

The private IP address assigned to the instance.

Subnetwork string

The name or self_link of the subnetwork attached to this interface.

SubnetworkProject string

The project in which the subnetwork belongs.

accessConfigs GetInstanceNetworkInterfaceAccessConfig[]

Access configurations, i.e. IPs via which this instance can be accessed via the Internet. Structure documented below.

aliasIpRanges GetInstanceNetworkInterfaceAliasIpRange[]

An array of alias IP ranges for this network interface. Structure documented below.

name string

The name of the instance. One of name or self_link must be provided.

network string

The name or self_link of the network attached to this interface.

networkIp string

The private IP address assigned to the instance.

subnetwork string

The name or self_link of the subnetwork attached to this interface.

subnetworkProject string

The project in which the subnetwork belongs.

accessConfigs List[GetInstanceNetworkInterfaceAccessConfig]

Access configurations, i.e. IPs via which this instance can be accessed via the Internet. Structure documented below.

aliasIpRanges List[GetInstanceNetworkInterfaceAliasIpRange]

An array of alias IP ranges for this network interface. Structure documented below.

name str

The name of the instance. One of name or self_link must be provided.

network str

The name or self_link of the network attached to this interface.

networkIp str

The private IP address assigned to the instance.

subnetwork str

The name or self_link of the subnetwork attached to this interface.

subnetworkProject str

The project in which the subnetwork belongs.

GetInstanceNetworkInterfaceAccessConfig

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

NatIp string

The IP address that is be 1:1 mapped to the instance’s network ip.

NetworkTier string

The [networking tier][network-tier] used for configuring this instance. One of PREMIUM or STANDARD.

PublicPtrDomainName string

The DNS domain name for the public PTR record.

NatIp string

The IP address that is be 1:1 mapped to the instance’s network ip.

NetworkTier string

The [networking tier][network-tier] used for configuring this instance. One of PREMIUM or STANDARD.

PublicPtrDomainName string

The DNS domain name for the public PTR record.

natIp string

The IP address that is be 1:1 mapped to the instance’s network ip.

networkTier string

The [networking tier][network-tier] used for configuring this instance. One of PREMIUM or STANDARD.

publicPtrDomainName string

The DNS domain name for the public PTR record.

natIp str

The IP address that is be 1:1 mapped to the instance’s network ip.

network_tier str

The [networking tier][network-tier] used for configuring this instance. One of PREMIUM or STANDARD.

publicPtrDomainName str

The DNS domain name for the public PTR record.

GetInstanceNetworkInterfaceAliasIpRange

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

IpCidrRange string

The IP CIDR range represented by this alias IP range.

SubnetworkRangeName string

The subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range.

IpCidrRange string

The IP CIDR range represented by this alias IP range.

SubnetworkRangeName string

The subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range.

ipCidrRange string

The IP CIDR range represented by this alias IP range.

subnetworkRangeName string

The subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range.

ip_cidr_range str

The IP CIDR range represented by this alias IP range.

subnetworkRangeName str

The subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range.

GetInstanceScheduling

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

AutomaticRestart bool

Specifies if the instance should be restarted if it was terminated by Compute Engine (not a user).

MinNodeCpus int
NodeAffinities List<GetInstanceSchedulingNodeAffinityArgs>
OnHostMaintenance string

Describes maintenance behavior for the instance. One of MIGRATE or TERMINATE, for more info, read here

Preemptible bool

Whether the instance is preemptible.

AutomaticRestart bool

Specifies if the instance should be restarted if it was terminated by Compute Engine (not a user).

MinNodeCpus int
NodeAffinities []GetInstanceSchedulingNodeAffinity
OnHostMaintenance string

Describes maintenance behavior for the instance. One of MIGRATE or TERMINATE, for more info, read here

Preemptible bool

Whether the instance is preemptible.

automaticRestart boolean

Specifies if the instance should be restarted if it was terminated by Compute Engine (not a user).

minNodeCpus number
nodeAffinities GetInstanceSchedulingNodeAffinity[]
onHostMaintenance string

Describes maintenance behavior for the instance. One of MIGRATE or TERMINATE, for more info, read here

preemptible boolean

Whether the instance is preemptible.

automaticRestart bool

Specifies if the instance should be restarted if it was terminated by Compute Engine (not a user).

minNodeCpus float
nodeAffinities List[GetInstanceSchedulingNodeAffinity]
onHostMaintenance str

Describes maintenance behavior for the instance. One of MIGRATE or TERMINATE, for more info, read here

preemptible bool

Whether the instance is preemptible.

GetInstanceSchedulingNodeAffinity

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Key string
Operator string
Values List<string>
Key string
Operator string
Values []string
key string
operator string
values string[]
key str
operator str
values List[str]

GetInstanceScratchDisk

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Interface string

The disk interface used for attaching this disk. One of SCSI or NVME.

Interface string

The disk interface used for attaching this disk. One of SCSI or NVME.

interface string

The disk interface used for attaching this disk. One of SCSI or NVME.

interface str

The disk interface used for attaching this disk. One of SCSI or NVME.

GetInstanceServiceAccount

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Email string

The service account e-mail address.

Scopes List<string>

A list of service scopes.

Email string

The service account e-mail address.

Scopes []string

A list of service scopes.

email string

The service account e-mail address.

scopes string[]

A list of service scopes.

email str

The service account e-mail address.

scopes List[str]

A list of service scopes.

GetInstanceShieldedInstanceConfig

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

EnableIntegrityMonitoring bool
EnableSecureBoot bool
EnableVtpm bool
EnableIntegrityMonitoring bool
EnableSecureBoot bool
EnableVtpm bool
enableIntegrityMonitoring boolean
enableSecureBoot boolean
enableVtpm boolean
enableIntegrityMonitoring bool
enableSecureBoot bool
enableVtpm bool

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.