Skip to content

Latest commit

 

History

History
152 lines (107 loc) · 4.77 KB

compute_instance.md

File metadata and controls

152 lines (107 loc) · 4.77 KB
page_title subcategory description
t1_compute_instance Resource - terraform-provider-t1
Manages a compute VM instance resource within T1.Cloud Compute.

t1_compute_instance (Resource)

Manages a compute VM instance resource within T1.Cloud Compute.

Example Usage

data "t1_compute_flavor" "small" {
  vcpus          = 2
  ram            = 4
  family         = "general-purpose"
  cpu_series     = "Intel Ice lake 2.8 GHz"
  hardware_group = "public"
}

data "t1_compute_image" "astra" {
  os_distro  = "astra"
  os_version = "1.7.3 Орёл"
}

data "t1_vpc_network" "default" {
  name = "default"
}

resource "t1_compute_ssh_key" "test" {
  name        = "test-ssh"
  login       = "root"
  public_keys = [
	"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCD+ACR4ubu98ti0aJOxL/Nwn6dlV++PCDY4HrkgScacPxIVbgo82P/qJ/VJEc29AbKYLGDsJ1NoK8xp320UCv1FCDHzZMKEeUQU8lfTvpN2hvTQlYp42ooGSsJgp4AM4wVYs8UBfbOerXquV/rQ6t7QiECJXq5e3gNu9C7hioOmw== "
  ]
}

resource "t1_compute_instance" "vm" {
  system_volume = {
    size = 10
  }

  flavor = data.t1_compute_flavor.small
  image  = data.t1_compute_image.astra

  network_interface = {
    subnet_id = data.t1_vpc_network.default.subnets[0].id
  }
   ssh_keys = [
    t1_compute_ssh_key.ssh.id,
  ]
}

Schema

Required

  • flavor (Attributes) Desired cores and memory configuration for VM instance. Changing this resizes the existing VM. To perform resize required switch VM state to off (see below for nested schema)
  • image (Attributes) Used to :
    • fetch data about one of standard cloud images (Windows Server, Ubuntu etc);
    • fetch data about custom image item using custom_image_id; (see below for nested schema)
  • network_interface (Attributes) Configuration of network interface attached to VM instance. (see below for nested schema)
  • ssh_keys (List of String) List of ssh keys ID, which public keys will be granted access to VM instance.
  • system_volume (Attributes) The boot volume config for VM instance. (see below for nested schema)

Optional

  • allow_delete_volumes (Boolean) Allows to delete all attached volumes (including system) while instance destruction. Flag useful when you desire clean destruction of an instance. Default false.
  • description (String) An optional description of the VM instance.
  • name (String) A name for the VM instance. Changing this creates a new VM.
  • region (String) The region where the VM will be placed.
  • state (String) Allows to switch VM state from on to off. Default on
  • zone (String) The availability zone of region where the VM will be placed

Read-Only

  • id (String) The order ID of this resource.

Nested Schema for flavor

Required:

  • cpu_series (String) Series of CPU (Intel, AMD, etc.)
  • family (String) Processor family: one of [general-purpose, Advanced]
  • hardware_group (String) Resources for public cloud or for private cloud.
  • id (String) ID of specified flavor.
  • name (String) Name of the flavor.
  • ram (Number) Quantity of RAM (specified in GB).
  • vcpus (Number) Quantity of virtual CPUs.

Nested Schema for image

Required:

  • id (String) Image ID.
  • name (String) Image code name.
  • os_distro (String) OS distro one of [ubuntu, windows, alt, astra, etc].
  • os_version (String) Verison of distro OS.
  • size (Number) Image size in bytes.

Optional:

  • custom_image_id (String) ID of custom compute image item.

Nested Schema for network_interface

Required:

  • subnet_id (String) ID of the subnet to which the instance network_interface would be connected.

Optional:

  • fixed_ip (String) When you enter an IP address, it is checked to see if it is busy and whether it belongs to the selected subnet. If empty, the address will be automatically assigned from the specified subnet.
  • security_group_ids (List of String) Security group IDs for network interface.

Read-Only:

  • id (String) ID of nic item attached to VM instance.

Nested Schema for system_volume

Required:

  • size (Number) Size of the persistent boot volume (specified in GB). size value must be greater than size of source image (at least 1 Gb).

Optional:

  • disk_type (String) Type of boot volume disk (e.g. Light, Basic). Defaults to Light. Changing this will replace resource.

Read-Only:

  • id (String) ID of the boot_volume item

Import

Import is supported using the following syntax:

terraform import t1_compute_instance.example <instance_order_id>