» yandex_compute_instance
Get information about a Yandex Compute instance. For more information, see the official documentation.
» Example Usage
data "yandex_compute_instance" "my_instance" {
instance_id = "some_instance_id"
}
output "instance_external_ip" {
value = "${data.yandex_compute_instance.my_instance.network_interface.0.nat_ip_address}"
}
» Argument Reference
The following arguments are supported:
-
instance_id
- (Optional) The ID of a specific instance. -
name
- (Optional) Name of the instance.
NOTE: One of instance_id
or name
should be specified.
» Attributes Reference
-
description
- Description of the instance. -
folder_id
- ID of the folder that the instance belongs to. -
fqdn
- FQDN of the instance. -
zone
- Availability zone where the instance resides. -
labels
- A set of key/value label pairs to assign to the instance. -
metadata
- Metadata key/value pairs to make available from within the instance. -
platform_id
- Type of virtual machine to create. Default is 'standard-v1'. -
status
- 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. -
boot_disk
- The boot disk for the instance. Structure is documented below. -
network_interface
- 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. -
secondary_disk
- List of secondary disks attached to the instance. Structure is documented below. -
scheduling_policy
- Scheduling policy configuration. The structure is documented below. -
service_account_id
- ID of the service account authorized for this instance. -
created_at
- Instance creation timestamp.
The boot_disk
block supports:
-
auto_delete
- Whether the disk is auto-deleted when the instance is deleted. The default value is false. -
device_name
- Name that can be used to access an attached disk under/dev/disk/by-id/
. -
mode
- Access to the disk resource. By default a disk is attached inREAD_WRITE
mode. -
disk_id
- ID of the attached disk. -
initialize_params
- Parameters used for creating a disk alongside the instance. The structure is documented below.
The initialize_params
block supports:
-
name
- Name of the boot disk. -
description
- Description of the boot disk. -
size
- Size of the disk in GB. -
type
- Disk type. -
image_id
- A disk image to initialize this disk from. -
snapshot_id
- A snapshot to initialize this disk from.
The network_interface
block supports:
-
index
- The index of the network interface, generated by the server. -
mac_address
- MAC address that is assigned to the network interface. -
ip_address
- The private IP address to assign to the instance. If empty, the address is automatically assigned from the specified subnet. -
subnet_id
- ID of the subnet to attach this interface to. The subnet must reside in the same zone where this instance was created. -
nat
- Assigned for the instance's public address that is used to access the internet over NAT. -
nat_ip_address
- Public IP address of the instance. -
nat_ip_version
- IP version for the public address.
The secondary_disk
block supports:
-
auto_delete
- Specifies whether the disk is auto-deleted when the instance is deleted. -
device_name
- This value can be used to reference the device from within the instance for mounting, resizing, and so on. -
mode
- Access to the Disk resource. By default, a disk is attached inREAD_WRITE
mode. -
disk_id
- ID of the disk that is attached to the instance.
The scheduling_policy
block supports:
-
preemptible
- (Optional) Specifies if the instance is preemptible. Defaults to false.