Yandex

v0.10.0 published on Thursday, Nov 18, 2021 by Pulumi

getComputeInstance

Get information about a Yandex Compute instance. For more information, see the official documentation.

Example Usage

using Pulumi;
using Yandex = Pulumi.Yandex;

class MyStack : Stack
{
    public MyStack()
    {
        var myInstance = Output.Create(Yandex.GetComputeInstance.InvokeAsync(new Yandex.GetComputeInstanceArgs
        {
            InstanceId = "some_instance_id",
        }));
        this.InstanceExternalIp = myInstance.Apply(myInstance => myInstance.NetworkInterfaces?[0]?.NatIpAddress);
    }

    [Output("instanceExternalIp")]
    public Output<string> InstanceExternalIp { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-yandex/sdk/go/yandex"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := "some_instance_id"
		myInstance, err := yandex.LookupComputeInstance(ctx, &GetComputeInstanceArgs{
			InstanceId: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("instanceExternalIp", myInstance.NetworkInterfaces[0].NatIpAddress)
		return nil
	})
}
import pulumi
import pulumi_yandex as yandex

my_instance = yandex.get_compute_instance(instance_id="some_instance_id")
pulumi.export("instanceExternalIp", my_instance.network_interfaces[0].nat_ip_address)
import * as pulumi from "@pulumi/pulumi";
import * as yandex from "@pulumi/yandex";

const myInstance = pulumi.output(yandex.getComputeInstance({
    instanceId: "some_instance_id",
}));

export const instanceExternalIp = myInstance.networkInterfaces[0].natIpAddress;

Using getComputeInstance

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 getComputeInstance(args: GetComputeInstanceArgs, opts?: InvokeOptions): Promise<GetComputeInstanceResult>
function getComputeInstanceOutput(args: GetComputeInstanceOutputArgs, opts?: InvokeOptions): Output<GetComputeInstanceResult>
def get_compute_instance(folder_id: Optional[str] = None,
                         instance_id: Optional[str] = None,
                         name: Optional[str] = None,
                         placement_policy: Optional[GetComputeInstancePlacementPolicy] = None,
                         scheduling_policy: Optional[GetComputeInstanceSchedulingPolicy] = None,
                         opts: Optional[InvokeOptions] = None) -> GetComputeInstanceResult
def get_compute_instance_output(folder_id: Optional[pulumi.Input[str]] = None,
                         instance_id: Optional[pulumi.Input[str]] = None,
                         name: Optional[pulumi.Input[str]] = None,
                         placement_policy: Optional[pulumi.Input[GetComputeInstancePlacementPolicyArgs]] = None,
                         scheduling_policy: Optional[pulumi.Input[GetComputeInstanceSchedulingPolicyArgs]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetComputeInstanceResult]
func LookupComputeInstance(ctx *Context, args *LookupComputeInstanceArgs, opts ...InvokeOption) (*LookupComputeInstanceResult, error)
func LookupComputeInstanceOutput(ctx *Context, args *LookupComputeInstanceOutputArgs, opts ...InvokeOption) LookupComputeInstanceResultOutput

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

public static class GetComputeInstance 
{
    public static Task<GetComputeInstanceResult> InvokeAsync(GetComputeInstanceArgs args, InvokeOptions? opts = null)
    public static Output<GetComputeInstanceResult> Invoke(GetComputeInstanceInvokeArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

FolderId string
Folder that the resource belongs to. If value is omitted, the default provider folder is used.
InstanceId string
The ID of a specific instance.
Name string
Name of the instance.
PlacementPolicy GetComputeInstancePlacementPolicy
SchedulingPolicy GetComputeInstanceSchedulingPolicy
Scheduling policy configuration. The structure is documented below.
FolderId string
Folder that the resource belongs to. If value is omitted, the default provider folder is used.
InstanceId string
The ID of a specific instance.
Name string
Name of the instance.
PlacementPolicy GetComputeInstancePlacementPolicy
SchedulingPolicy GetComputeInstanceSchedulingPolicy
Scheduling policy configuration. The structure is documented below.
folderId string
Folder that the resource belongs to. If value is omitted, the default provider folder is used.
instanceId string
The ID of a specific instance.
name string
Name of the instance.
placementPolicy GetComputeInstancePlacementPolicy
schedulingPolicy GetComputeInstanceSchedulingPolicy
Scheduling policy configuration. The structure is documented below.
folder_id str
Folder that the resource belongs to. If value is omitted, the default provider folder is used.
instance_id str
The ID of a specific instance.
name str
Name of the instance.
placement_policy GetComputeInstancePlacementPolicy
scheduling_policy GetComputeInstanceSchedulingPolicy
Scheduling policy configuration. The structure is documented below.

getComputeInstance Result

The following output properties are available:

BootDisk GetComputeInstanceBootDisk
The boot disk for the instance. Structure is documented below.
CreatedAt string
Instance creation timestamp.
Description string
Description of the boot disk.
FolderId string
Fqdn string
DNS record FQDN.
Id string
The provider-assigned unique ID for this managed resource.
InstanceId string
Labels Dictionary<string, string>
A set of key/value label pairs assigned to the instance.
Metadata Dictionary<string, string>
Metadata key/value pairs to make available from within the instance.
Name string
Name of the boot disk.
NetworkAccelerationType string
Type of network acceleration. The default is standard. Values: standard, software_accelerated
NetworkInterfaces List<GetComputeInstanceNetworkInterface>

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

  • network_interface.0.ip_address - An internal IP address of the instance, either manually or dynamically assigned.
  • network_interface.0.nat_ip_address - An assigned external IP address if the instance has NAT enabled.
PlatformId string
Type of virtual machine to create. Default is ‘standard-v1’.
Resources GetComputeInstanceResources
SchedulingPolicy GetComputeInstanceSchedulingPolicy
Scheduling policy configuration. The structure is documented below.
SecondaryDisks List<GetComputeInstanceSecondaryDisk>
List of secondary disks attached to the instance. Structure is documented below.
ServiceAccountId string
ID of the service account authorized for this instance.
Status string

Status of the instance.

  • resources.0.memory - Memory size allocated for the instance.
  • resources.0.cores - Number of CPU cores allocated for the instance.
  • resources.0.core_fraction - Baseline performance for a core, set as a percent.
  • resources.0.gpus - Number of GPU cores allocated for the instance.
Zone string
Availability zone where the instance resides.
PlacementPolicy GetComputeInstancePlacementPolicy
BootDisk GetComputeInstanceBootDisk
The boot disk for the instance. Structure is documented below.
CreatedAt string
Instance creation timestamp.
Description string
Description of the boot disk.
FolderId string
Fqdn string
DNS record FQDN.
Id string
The provider-assigned unique ID for this managed resource.
InstanceId string
Labels map[string]string
A set of key/value label pairs assigned to the instance.
Metadata map[string]string
Metadata key/value pairs to make available from within the instance.
Name string
Name of the boot disk.
NetworkAccelerationType string
Type of network acceleration. The default is standard. Values: standard, software_accelerated
NetworkInterfaces []GetComputeInstanceNetworkInterface

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

  • network_interface.0.ip_address - An internal IP address of the instance, either manually or dynamically assigned.
  • network_interface.0.nat_ip_address - An assigned external IP address if the instance has NAT enabled.
PlatformId string
Type of virtual machine to create. Default is ‘standard-v1’.
Resources GetComputeInstanceResources
SchedulingPolicy GetComputeInstanceSchedulingPolicy
Scheduling policy configuration. The structure is documented below.
SecondaryDisks []GetComputeInstanceSecondaryDisk
List of secondary disks attached to the instance. Structure is documented below.
ServiceAccountId string
ID of the service account authorized for this instance.
Status string

Status of the instance.

  • resources.0.memory - Memory size allocated for the instance.
  • resources.0.cores - Number of CPU cores allocated for the instance.
  • resources.0.core_fraction - Baseline performance for a core, set as a percent.
  • resources.0.gpus - Number of GPU cores allocated for the instance.
Zone string
Availability zone where the instance resides.
PlacementPolicy GetComputeInstancePlacementPolicy
bootDisk GetComputeInstanceBootDisk
The boot disk for the instance. Structure is documented below.
createdAt string
Instance creation timestamp.
description string
Description of the boot disk.
folderId string
fqdn string
DNS record FQDN.
id string
The provider-assigned unique ID for this managed resource.
instanceId string
labels {[key: string]: string}
A set of key/value label pairs assigned to the instance.
metadata {[key: string]: string}
Metadata key/value pairs to make available from within the instance.
name string
Name of the boot disk.
networkAccelerationType string
Type of network acceleration. The default is standard. Values: standard, software_accelerated
networkInterfaces GetComputeInstanceNetworkInterface[]

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

  • network_interface.0.ip_address - An internal IP address of the instance, either manually or dynamically assigned.
  • network_interface.0.nat_ip_address - An assigned external IP address if the instance has NAT enabled.
platformId string
Type of virtual machine to create. Default is ‘standard-v1’.
resources GetComputeInstanceResources
schedulingPolicy GetComputeInstanceSchedulingPolicy
Scheduling policy configuration. The structure is documented below.
secondaryDisks GetComputeInstanceSecondaryDisk[]
List of secondary disks attached to the instance. Structure is documented below.
serviceAccountId string
ID of the service account authorized for this instance.
status string

Status of the instance.

  • resources.0.memory - Memory size allocated for the instance.
  • resources.0.cores - Number of CPU cores allocated for the instance.
  • resources.0.core_fraction - Baseline performance for a core, set as a percent.
  • resources.0.gpus - Number of GPU cores allocated for the instance.
zone string
Availability zone where the instance resides.
placementPolicy GetComputeInstancePlacementPolicy
boot_disk GetComputeInstanceBootDisk
The boot disk for the instance. Structure is documented below.
created_at str
Instance creation timestamp.
description str
Description of the boot disk.
folder_id str
fqdn str
DNS record FQDN.
id str
The provider-assigned unique ID for this managed resource.
instance_id str
labels Mapping[str, str]
A set of key/value label pairs assigned to the instance.
metadata Mapping[str, str]
Metadata key/value pairs to make available from within the instance.
name str
Name of the boot disk.
network_acceleration_type str
Type of network acceleration. The default is standard. Values: standard, software_accelerated
network_interfaces Sequence[GetComputeInstanceNetworkInterface]

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

  • network_interface.0.ip_address - An internal IP address of the instance, either manually or dynamically assigned.
  • network_interface.0.nat_ip_address - An assigned external IP address if the instance has NAT enabled.
platform_id str
Type of virtual machine to create. Default is ‘standard-v1’.
resources GetComputeInstanceResources
scheduling_policy GetComputeInstanceSchedulingPolicy
Scheduling policy configuration. The structure is documented below.
secondary_disks Sequence[GetComputeInstanceSecondaryDisk]
List of secondary disks attached to the instance. Structure is documented below.
service_account_id str
ID of the service account authorized for this instance.
status str

Status of the instance.

  • resources.0.memory - Memory size allocated for the instance.
  • resources.0.cores - Number of CPU cores allocated for the instance.
  • resources.0.core_fraction - Baseline performance for a core, set as a percent.
  • resources.0.gpus - Number of GPU cores allocated for the instance.
zone str
Availability zone where the instance resides.
placement_policy GetComputeInstancePlacementPolicy

Supporting Types

GetComputeInstanceBootDisk

AutoDelete bool
Specifies whether the disk is auto-deleted when the instance is deleted.
DeviceName string
This value can be used to reference the device from within the instance for mounting, resizing, and so on.
DiskId string
ID of the disk that is attached to the instance.
InitializeParams List<GetComputeInstanceBootDiskInitializeParam>
Parameters used for creating a disk alongside the instance. The structure is documented below.
Mode string
Access to the Disk resource. By default, a disk is attached in READ_WRITE mode.
AutoDelete bool
Specifies whether the disk is auto-deleted when the instance is deleted.
DeviceName string
This value can be used to reference the device from within the instance for mounting, resizing, and so on.
DiskId string
ID of the disk that is attached to the instance.
InitializeParams []GetComputeInstanceBootDiskInitializeParam
Parameters used for creating a disk alongside the instance. The structure is documented below.
Mode string
Access to the Disk resource. By default, a disk is attached in READ_WRITE mode.
autoDelete boolean
Specifies whether the disk is auto-deleted when the instance is deleted.
deviceName string
This value can be used to reference the device from within the instance for mounting, resizing, and so on.
diskId string
ID of the disk that is attached to the instance.
initializeParams GetComputeInstanceBootDiskInitializeParam[]
Parameters used for creating a disk alongside the instance. The structure is documented below.
mode string
Access to the Disk resource. By default, a disk is attached in READ_WRITE mode.
auto_delete bool
Specifies whether the disk is auto-deleted when the instance is deleted.
device_name str
This value can be used to reference the device from within the instance for mounting, resizing, and so on.
disk_id str
ID of the disk that is attached to the instance.
initialize_params Sequence[GetComputeInstanceBootDiskInitializeParam]
Parameters used for creating a disk alongside the instance. The structure is documented below.
mode str
Access to the Disk resource. By default, a disk is attached in READ_WRITE mode.

GetComputeInstanceBootDiskInitializeParam

Description string
Description of the boot disk.
ImageId string
A disk image to initialize this disk from.
Name string
Name of the instance.
Size int
Size of the disk in GB.
SnapshotId string
A snapshot to initialize this disk from.
Type string
Disk type.
Description string
Description of the boot disk.
ImageId string
A disk image to initialize this disk from.
Name string
Name of the instance.
Size int
Size of the disk in GB.
SnapshotId string
A snapshot to initialize this disk from.
Type string
Disk type.
description string
Description of the boot disk.
imageId string
A disk image to initialize this disk from.
name string
Name of the instance.
size number
Size of the disk in GB.
snapshotId string
A snapshot to initialize this disk from.
type string
Disk type.
description str
Description of the boot disk.
image_id str
A disk image to initialize this disk from.
name str
Name of the instance.
size int
Size of the disk in GB.
snapshot_id str
A snapshot to initialize this disk from.
type str
Disk type.

GetComputeInstanceNetworkInterface

DnsRecords List<GetComputeInstanceNetworkInterfaceDnsRecord>
List of configurations for creating ipv4 DNS records. The structure is documented below.
Index int
The index of the network interface, generated by the server.
IpAddress string
The assignd private IP address to the network interface.
Ipv4 bool
Show if IPv4 address is assigned to the network interface.
Ipv6 bool
Ipv6Address string
Ipv6DnsRecords List<GetComputeInstanceNetworkInterfaceIpv6DnsRecord>
List of configurations for creating ipv6 DNS records. The structure is documented below.
MacAddress string
MAC address that is assigned to the network interface.
Nat bool
Assigned for the instance’s public address that is used to access the internet over NAT.
NatDnsRecords List<GetComputeInstanceNetworkInterfaceNatDnsRecord>
List of configurations for creating ipv4 NAT DNS records. The structure is documented below.
NatIpAddress string
Public IP address of the instance.
NatIpVersion string
IP version for the public address.
SecurityGroupIds List<string>
Security group ids for network interface.
SubnetId string
ID of the subnet to attach this interface to. The subnet must reside in the same zone where this instance was created.
DnsRecords []GetComputeInstanceNetworkInterfaceDnsRecord
List of configurations for creating ipv4 DNS records. The structure is documented below.
Index int
The index of the network interface, generated by the server.
IpAddress string
The assignd private IP address to the network interface.
Ipv4 bool
Show if IPv4 address is assigned to the network interface.
Ipv6 bool
Ipv6Address string
Ipv6DnsRecords []GetComputeInstanceNetworkInterfaceIpv6DnsRecord
List of configurations for creating ipv6 DNS records. The structure is documented below.
MacAddress string
MAC address that is assigned to the network interface.
Nat bool
Assigned for the instance’s public address that is used to access the internet over NAT.
NatDnsRecords []GetComputeInstanceNetworkInterfaceNatDnsRecord
List of configurations for creating ipv4 NAT DNS records. The structure is documented below.
NatIpAddress string
Public IP address of the instance.
NatIpVersion string
IP version for the public address.
SecurityGroupIds []string
Security group ids for network interface.
SubnetId string
ID of the subnet to attach this interface to. The subnet must reside in the same zone where this instance was created.
dnsRecords GetComputeInstanceNetworkInterfaceDnsRecord[]
List of configurations for creating ipv4 DNS records. The structure is documented below.
index number
The index of the network interface, generated by the server.
ipAddress string
The assignd private IP address to the network interface.
ipv4 boolean
Show if IPv4 address is assigned to the network interface.
ipv6 boolean
ipv6Address string
ipv6DnsRecords GetComputeInstanceNetworkInterfaceIpv6DnsRecord[]
List of configurations for creating ipv6 DNS records. The structure is documented below.
macAddress string
MAC address that is assigned to the network interface.
nat boolean
Assigned for the instance’s public address that is used to access the internet over NAT.
natDnsRecords GetComputeInstanceNetworkInterfaceNatDnsRecord[]
List of configurations for creating ipv4 NAT DNS records. The structure is documented below.
natIpAddress string
Public IP address of the instance.
natIpVersion string
IP version for the public address.
securityGroupIds string[]
Security group ids for network interface.
subnetId string
ID of the subnet to attach this interface to. The subnet must reside in the same zone where this instance was created.
dns_records Sequence[GetComputeInstanceNetworkInterfaceDnsRecord]
List of configurations for creating ipv4 DNS records. The structure is documented below.
index int
The index of the network interface, generated by the server.
ip_address str
The assignd private IP address to the network interface.
ipv4 bool
Show if IPv4 address is assigned to the network interface.
ipv6 bool
ipv6_address str
ipv6_dns_records Sequence[GetComputeInstanceNetworkInterfaceIpv6DnsRecord]
List of configurations for creating ipv6 DNS records. The structure is documented below.
mac_address str
MAC address that is assigned to the network interface.
nat bool
Assigned for the instance’s public address that is used to access the internet over NAT.
nat_dns_records Sequence[GetComputeInstanceNetworkInterfaceNatDnsRecord]
List of configurations for creating ipv4 NAT DNS records. The structure is documented below.
nat_ip_address str
Public IP address of the instance.
nat_ip_version str
IP version for the public address.
security_group_ids Sequence[str]
Security group ids for network interface.
subnet_id str
ID of the subnet to attach this interface to. The subnet must reside in the same zone where this instance was created.

GetComputeInstanceNetworkInterfaceDnsRecord

DnsZoneId string
DNS zone ID (if not set, private zone is used).
Fqdn string
DNS record FQDN.
Ptr bool
When set to true, also create a TR DNS record.
Ttl int
DNS record TTL. in seconds
DnsZoneId string
DNS zone ID (if not set, private zone is used).
Fqdn string
DNS record FQDN.
Ptr bool
When set to true, also create a TR DNS record.
Ttl int
DNS record TTL. in seconds
dnsZoneId string
DNS zone ID (if not set, private zone is used).
fqdn string
DNS record FQDN.
ptr boolean
When set to true, also create a TR DNS record.
ttl number
DNS record TTL. in seconds
dns_zone_id str
DNS zone ID (if not set, private zone is used).
fqdn str
DNS record FQDN.
ptr bool
When set to true, also create a TR DNS record.
ttl int
DNS record TTL. in seconds

GetComputeInstanceNetworkInterfaceIpv6DnsRecord

DnsZoneId string
DNS zone ID (if not set, private zone is used).
Fqdn string
DNS record FQDN.
Ptr bool
When set to true, also create a TR DNS record.
Ttl int
DNS record TTL. in seconds
DnsZoneId string
DNS zone ID (if not set, private zone is used).
Fqdn string
DNS record FQDN.
Ptr bool
When set to true, also create a TR DNS record.
Ttl int
DNS record TTL. in seconds
dnsZoneId string
DNS zone ID (if not set, private zone is used).
fqdn string
DNS record FQDN.
ptr boolean
When set to true, also create a TR DNS record.
ttl number
DNS record TTL. in seconds
dns_zone_id str
DNS zone ID (if not set, private zone is used).
fqdn str
DNS record FQDN.
ptr bool
When set to true, also create a TR DNS record.
ttl int
DNS record TTL. in seconds

GetComputeInstanceNetworkInterfaceNatDnsRecord

DnsZoneId string
DNS zone ID (if not set, private zone is used).
Fqdn string
DNS record FQDN.
Ptr bool
When set to true, also create a TR DNS record.
Ttl int
DNS record TTL. in seconds
DnsZoneId string
DNS zone ID (if not set, private zone is used).
Fqdn string
DNS record FQDN.
Ptr bool
When set to true, also create a TR DNS record.
Ttl int
DNS record TTL. in seconds
dnsZoneId string
DNS zone ID (if not set, private zone is used).
fqdn string
DNS record FQDN.
ptr boolean
When set to true, also create a TR DNS record.
ttl number
DNS record TTL. in seconds
dns_zone_id str
DNS zone ID (if not set, private zone is used).
fqdn str
DNS record FQDN.
ptr bool
When set to true, also create a TR DNS record.
ttl int
DNS record TTL. in seconds

GetComputeInstancePlacementPolicy

GetComputeInstanceResources

CoreFraction int
Cores int
Gpus int
Memory double
CoreFraction int
Cores int
Gpus int
Memory float64
coreFraction number
cores number
gpus number
memory number

GetComputeInstanceSchedulingPolicy

Preemptible bool
(Optional) Specifies if the instance is preemptible. Defaults to false.
Preemptible bool
(Optional) Specifies if the instance is preemptible. Defaults to false.
preemptible boolean
(Optional) Specifies if the instance is preemptible. Defaults to false.
preemptible bool
(Optional) Specifies if the instance is preemptible. Defaults to false.

GetComputeInstanceSecondaryDisk

AutoDelete bool
Specifies whether the disk is auto-deleted when the instance is deleted.
DeviceName string
This value can be used to reference the device from within the instance for mounting, resizing, and so on.
DiskId string
ID of the disk that is attached to the instance.
Mode string
Access to the Disk resource. By default, a disk is attached in READ_WRITE mode.
AutoDelete bool
Specifies whether the disk is auto-deleted when the instance is deleted.
DeviceName string
This value can be used to reference the device from within the instance for mounting, resizing, and so on.
DiskId string
ID of the disk that is attached to the instance.
Mode string
Access to the Disk resource. By default, a disk is attached in READ_WRITE mode.
autoDelete boolean
Specifies whether the disk is auto-deleted when the instance is deleted.
deviceName string
This value can be used to reference the device from within the instance for mounting, resizing, and so on.
diskId string
ID of the disk that is attached to the instance.
mode string
Access to the Disk resource. By default, a disk is attached in READ_WRITE mode.
auto_delete bool
Specifies whether the disk is auto-deleted when the instance is deleted.
device_name str
This value can be used to reference the device from within the instance for mounting, resizing, and so on.
disk_id str
ID of the disk that is attached to the instance.
mode str
Access to the Disk resource. By default, a disk is attached in READ_WRITE mode.

Package Details

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