Yandex Cloud
Поиск
Связаться с намиПодключиться
  • Истории успеха
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
    • Популярные
    • Инфраструктура и сеть
    • Платформа данных
    • Контейнеры
    • Инструменты разработчика
    • Бессерверные вычисления
    • Безопасность
    • Мониторинг и управление ресурсами
    • ИИ для бизнеса
    • Бизнес-инструменты
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Облако для интеграторов
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Контент-программа
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Калькулятор цен
    • Тарифы
    • Промоакции и free tier
    • Правила тарификации
  • Истории успеха
  • Документация
  • Блог
Проект Яндекса
© 2025 ООО «Яндекс.Облако»
Terraform в Yandex Cloud
  • Начало работы
  • Библиотека решений
    • Обзор
    • История изменений (англ.)
          • compute_disk
          • compute_disk_placement_group
          • compute_filesystem
          • compute_gpu_cluster
          • compute_image
          • compute_instance
          • compute_instance_group
          • compute_placement_group
          • compute_snapshot
          • compute_snapshot_schedule

В этой статье:

  • Example usage
  • Schema
  • Optional
  • Read-Only
  • Nested Schema for filesystem
  • Nested Schema for local_disk
  • Nested Schema for metadata_options
  • Nested Schema for placement_policy
  • Nested Schema for placement_policy.host_affinity_rules
  • Nested Schema for boot_disk
  • Nested Schema for boot_disk.initialize_params
  • Nested Schema for hardware_generation
  • Nested Schema for hardware_generation.generation2_features
  • Nested Schema for hardware_generation.legacy_features
  • Nested Schema for network_interface
  • Nested Schema for network_interface.dns_record
  • Nested Schema for network_interface.ipv6_dns_record
  • Nested Schema for network_interface.nat_dns_record
  • Nested Schema for resources
  • Nested Schema for scheduling_policy
  • Nested Schema for secondary_disk
  1. Справочник Terraform
  2. Ресурсы (англ.)
  3. Compute Cloud
  4. Data Sources
  5. compute_instance

yandex_compute_instance (Data Source)

Статья создана
Yandex Cloud
Обновлена 2 октября 2025 г.
  • Example usage
  • Schema
    • Optional
    • Read-Only
    • Nested Schema for filesystem
    • Nested Schema for local_disk
    • Nested Schema for metadata_options
    • Nested Schema for placement_policy
    • Nested Schema for placement_policy.host_affinity_rules
    • Nested Schema for boot_disk
    • Nested Schema for boot_disk.initialize_params
    • Nested Schema for hardware_generation
    • Nested Schema for hardware_generation.generation2_features
    • Nested Schema for hardware_generation.legacy_features
    • Nested Schema for network_interface
    • Nested Schema for network_interface.dns_record
    • Nested Schema for network_interface.ipv6_dns_record
    • Nested Schema for network_interface.nat_dns_record
    • Nested Schema for resources
    • Nested Schema for scheduling_policy
    • Nested Schema for secondary_disk

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

Важно

One of instance_id or name should be specified.

Example usageExample usage

//
// Get information about existing Compute Instance.
//
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
}

SchemaSchema

OptionalOptional

  • filesystem (Block Set) List of filesystems that are attached to the instance. (see below for nested schema)
  • folder_id (String) The folder identifier that resource belongs to. If it is not provided, the default provider folder-id is used.
  • gpu_cluster_id (String) ID of the GPU cluster to attach this instance to.
  • instance_id (String) The ID of a specific instance.
  • local_disk (Block List) List of local disks that are attached to the instance.

Важно

Local disks are not available for all users by default. (see below for nested schema)

  • maintenance_grace_period (String) Time between notification via metadata service and maintenance. E.g., 60s.
  • maintenance_policy (String) Behavior on maintenance events. Can be: unspecified, migrate, restart. The default is unspecified.
  • metadata_options (Block List, Max: 1) Options allow user to configure access to instance's metadata. (see below for nested schema)
  • name (String) The resource name.
  • placement_policy (Block List, Max: 1) The placement policy configuration. (see below for nested schema)
  • service_account_id (String) Service account which linked to the resource.

Read-OnlyRead-Only

  • boot_disk (List of Object) The boot disk for the instance. Either initialize_params or disk_id must be specified. (see below for nested schema)
  • created_at (String) The creation timestamp of the resource.
  • description (String) The resource description.
  • fqdn (String) The fully qualified DNS name of this instance.
  • hardware_generation (List of Object) (see below for nested schema)
  • id (String) The ID of this resource.
  • labels (Map of String) A set of key/value label pairs which assigned to resource.
  • metadata (Map of String) Metadata key/value pairs to make available from within the instance.
  • network_acceleration_type (String) Type of network acceleration. Can be standard or software_accelerated. The default is standard.
  • network_interface (List of Object) Networks to attach to the instance. This can be specified multiple times. (see below for nested schema)
  • platform_id (String) The type of virtual machine to create.
  • resources (List of Object) Compute resources that are allocated for the instance. (see below for nested schema)
  • scheduling_policy (List of Object) Scheduling policy configuration. (see below for nested schema)
  • secondary_disk (Set of Object) A set of disks to attach to the instance. The structure is documented below.

Важно

The allow_stopping_for_update property must be set to true in order to update this structure. (see below for nested schema)

  • status (String) The status of this instance.
  • zone (String) The availability zone where resource is located. If it is not provided, the default provider zone will be used.

Nested Schema for Nested Schema for filesystem

Optional:

  • mode (String) Mode of access to the filesystem that should be attached. By default, filesystem is attached in READ_WRITE mode.

Read-Only:

  • device_name (String) Name of the device representing the filesystem on the instance.

  • filesystem_id (String) ID of the filesystem that should be attached.

Nested Schema for Nested Schema for local_disk

Required:

  • size_bytes (Number) Size of the disk, specified in bytes.

Read-Only:

  • device_name (String) The name of the local disk device.

Nested Schema for Nested Schema for metadata_options

Optional:

  • aws_v1_http_endpoint (Number)
  • aws_v1_http_token (Number)
  • gce_http_endpoint (Number)
  • gce_http_token (Number)

Nested Schema for Nested Schema for placement_policy

Optional:

  • host_affinity_rules (List of Object) List of host affinity rules. (see below for nested schema)

  • placement_group_id (String) Specifies the id of the Placement Group to assign to the instance.

  • placement_group_partition (Number)

Nested Schema for Nested Schema for placement_policy.host_affinity_rules

Optional:

  • key (String)
  • op (String)
  • values (List of String)

Nested Schema for Nested Schema for boot_disk

Read-Only:

  • auto_delete (Boolean) Defines whether the disk will be auto-deleted when the instance is deleted. The default value is True.

  • device_name (String) Name that can be used to access an attached disk.

  • disk_id (String) The ID of the existing disk (such as those managed by yandex_compute_disk) to attach as a boot disk.

  • initialize_params (Block List, Max: 1) Parameters for a new disk that will be created alongside the new instance. Either initialize_params or disk_id must be set. Either image_id or snapshot_id must be specified. (see below for nested schema)

  • mode (String) Type of access to the disk resource. By default, a disk is attached in READ_WRITE mode.

Nested Schema for Nested Schema for boot_disk.initialize_params

Read-Only:

  • block_size (Number) Block size of the disk, specified in bytes.

  • description (String) Description of the boot disk.

  • image_id (String) A disk image to initialize this disk from.

  • kms_key_id (String) ID of KMS symmetric key used to encrypt disk.

  • name (String) Name of the boot disk.

  • size (Number) Size of the disk in GB.

  • snapshot_id (String) A snapshot to initialize this disk from.

  • type (String) Disk type.

Nested Schema for Nested Schema for hardware_generation

Read-Only:

  • generation2_features (List of Object) (see below for nested schema) (see below for nested schema)

  • legacy_features (List of Object) (see below for nested schema) (see below for nested schema)

Nested Schema for Nested Schema for hardware_generation.generation2_features

Read-Only:

Nested Schema for Nested Schema for hardware_generation.legacy_features

Read-Only:

  • pci_topology (String)

Nested Schema for Nested Schema for network_interface

Read-Only:

  • dns_record (Block List) List of configurations for creating ipv4 DNS records. (see below for nested schema)

  • index (Number) Index of network interface, will be calculated automatically for instance create or update operations if not specified. Required for attach/detach operations.

  • ip_address (String) The private IP address to assign to the instance. If empty, the address will be automatically assigned from the specified subnet.

  • ipv4 (Boolean) Allocate an IPv4 address for the interface. The default value is true.

  • ipv6 (Boolean) If true, allocate an IPv6 address for the interface. The address will be automatically assigned from the specified subnet.

  • ipv6_address (String) The private IPv6 address to assign to the instance.

  • ipv6_dns_record (Block List) List of configurations for creating ipv6 DNS records. (see below for nested schema)

  • mac_address (String)

  • nat (Boolean) Provide a public address, for instance, to access the internet over NAT.

  • nat_dns_record (Block List) List of configurations for creating ipv4 NAT DNS records. (see below for nested schema)

  • nat_ip_address (String) Provide a public address, for instance, to access the internet over NAT. Address should be already reserved in web UI.

  • nat_ip_version (String)

  • security_group_ids (Set of String) Security Group (SG) IDs for network interface.

  • subnet_id (String) ID of the subnet to attach this interface to. The subnet must exist in the same zone where this instance will be created.

Nested Schema for Nested Schema for network_interface.dns_record

Read-Only:

  • dns_zone_id (String) DNS zone ID (if not set, private zone used).

  • fqdn (String) DNS record FQDN (must have a dot at the end).

  • ptr (Boolean) When set to true, also create a PTR DNS record.

  • ttl (Number) DNS record TTL in seconds.

Nested Schema for Nested Schema for network_interface.ipv6_dns_record

Read-Only:

  • dns_zone_id (String) DNS zone ID (if not set, private zone used).

  • fqdn (String) DNS record FQDN (must have a dot at the end).

  • ptr (Boolean) When set to true, also create a PTR DNS record.

  • ttl (Number) DNS record TTL in seconds.

Nested Schema for Nested Schema for network_interface.nat_dns_record

Read-Only:

  • dns_zone_id (String) DNS zone ID (if not set, private zone used).

  • fqdn (String) DNS record FQDN (must have a dot at the end).

  • ptr (Boolean) When set to true, also create a PTR DNS record.

  • ttl (Number) DNS record TTL in seconds.

Nested Schema for Nested Schema for resources

Read-Only:

  • core_fraction (Number) If provided, specifies baseline performance for a core as a percent.

  • cores (Number) CPU cores for the instance.

  • gpus (Number) If provided, specifies the number of GPU devices for the instance.

  • memory (Number) Memory size in GB.

Nested Schema for Nested Schema for scheduling_policy

Read-Only:

  • preemptible (Boolean) Specifies if the instance is preemptible. Defaults to false.

Nested Schema for Nested Schema for secondary_disk

Read-Only:

  • auto_delete (Boolean) Whether the disk is auto-deleted when the instance is deleted. The default value is false.

  • device_name (String) Name that can be used to access an attached disk under /dev/disk/by-id/.

  • disk_id (String) ID of the disk that is attached to the instance.

  • mode (String) Type of access to the disk resource. By default, a disk is attached in READ_WRITE mode.

Была ли статья полезна?

Предыдущая
compute_image
Следующая
compute_instance_group
Проект Яндекса
© 2025 ООО «Яндекс.Облако»