» 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.

» Attributes Reference


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 in READ_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 in READ_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.