×

cloupard_kvm_instance

 
Defines a KVM virtual machine instance.
 
Example usage
resource "cloupard_kvm_instance" "vm1" {
  region = "uz_tas2"
  cod = "unicon"                        # код ЦОД
  name = "tf_vm1"
  description = "test vm from tf"
  vm_type = "universal_lin"             # тип ВМ (универсальный Linux)
  os_template = "debian_12_minimal"     # шаблон ОС (Debian 12)
  os_admin_pass = "Qwer1234"            # пароль администратора ОС
  ssh_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJbOIrkRQapl6EGXleO0VUq0ZWZ65+YSwF6i/1TqYsIb infraaccess"  # добавление SSH ключа
  running = true                        # ВМ запускается сразу после создания
  in_test = true                        # тестовый период: да
  vcpu = 2                              # количество vCPU
  vram = 2                              # объем RAM (ГБ)
 
  # Диски ВМ
  disks = {
    "disk0" = {
      name = "disk0"
      type = "super"                    # тип диска: super
      size = 30
      description = "System"
      bootable = true                   # загрузочный диск
    },
    "disk1" = {
      name = "disk1"
      type = "standard"                 # тип диска: standard
      size = 40
      description = "Data1"
      bootable = false
    },
    "disk2" = {
      name = "disk2"
      type = "archive"                  # тип диска: archive
      size = 45
      description = "Data2"
      bootable = false
    }
  }
 
  # Сетевые подключения
  connections = {
    "net0" = {
      extip_id = cloupard_kvm_extip.ip2.id   # привязка внешнего IP ip2
    },
    "net1" = {
      vnet_id = cloupard_kvm_vnet.vnet1.id   # подключение к vnet1
    },
    "net2" = {
      vnet_id = cloupard_kvm_vnet.vnet2.id   # подключение к vnet2
    }
  }
}
 
Attributes:
 
  • region (Required): Region for the virtual machine.
  • cod (Required): Code of deployment site or environment.
  • name (Required): Name of the virtual machine.
  • description (Optional): Description of the instance.
  • vm_type (Required): Type of the virtual machine.
  • os_template (Required): OS image template used for deployment.
  • os_admin_pass (Required): Administrator password for the OS.
  • running (Optional): Whether the instance should start automatically.
  • in_test (Optional): Marks the VM as test.
  • vcpu (Required): Number of virtual CPUs.
  • vram (Required): Amount of virtual RAM in GB.
  • disks (Required): Map of disk definitions. Each disk block includes:
                name (Required): Name of the disk.
                type (Required): Disk type (e.g., super, standard, archive).
                size (Required): Disk size in GB.
                description (Optional): Disk description.
                bootable (Required): Whether the disk is bootable.
  • connections (Optional): Network interface definitions. Each connection includes:
                extip_id (Optional): External IP ID (if public).
                vnet_id (Optional): Virtual network ID.
  • id (Computed): Unique identifier for the virtual machine.