sless-primer/VM/vm.tf

38 lines
1.5 KiB
HCL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 2026-03-25 vm.tf: виртуальная машина (nubes_vc_vm_v3) внутри vApp.
// Зависит от nubes_vapp.vapp создаётся после vApp.
// image_vm, vapp_uid, user_public_key не изменяются после создания.
resource "nubes_vc_vm_v3" "vm" {
resource_name = "vm-sless-1"
vm_name = "web02" # Имя ВМ в Nubes vCD. Не изменяется после создания.
# Определяет имя NSX-T IP Set: {vapp_name}-{vm_name}
vapp_uid = nubes_vapp.vapp.id # ссылка на vApp. Не изменяется после создания.
image_vm = "Ubuntu_22-20G" # Не изменяется после создания.
# image_vm = "Ubuntu 22.04 LTS" # Не изменяется после создания.
ip_space_name = "internet-ipv4-v1"
user_login = "ubuntu"
user_public_key = var.vm_public_key # задаётся в terraform.tfvars
vm_cpu = 2
vm_ram = 2 # GB
vm_disk = 20 # GB
adopt_existing_on_create = true
operation_timeout = "15m"
# delete без предварительного suspend завершается ошибкой (аналогично vApp).
suspend_on_destroy = true
}
output "vm_id" {
value = nubes_vc_vm_v3.vm.id
description = "ID созданной ВМ"
}
output "vm_state" {
value = nubes_vc_vm_v3.vm.state_out_flat
description = "Плоский state ВМ — IP-адреса, статус и т.д."
}