Skip to content

rso_instance (Resource)

A virtual machine cloned from an OS template. CPU, memory and root disk can grow in place; CPU and memory changes take effect at the next reboot. The root disk can only grow.

Example Usage

# A virtual machine from an OS template, reachable with your SSH key.
data "rso_instance_templates" "all" {}

variable "template_name" {
  description = "Name of the OS template to clone."
  type        = string
  default     = "ubuntu-26.04"
}

variable "ssh_public_key" {
  description = "SSH public key installed for the default user."
  type        = string
  default     = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExampleKeyReplaceMeWithYourOwnPublicKey000 example"
}

resource "rso_instance" "vm" {
  name           = "tf-example-vm"
  template       = data.rso_instance_templates.all.by_name[var.template_name]
  cpus           = 1
  memory_mb      = 1024
  root_disk_gb   = 20
  ssh_public_key = var.ssh_public_key
}

output "instance_vmid" {
  value = rso_instance.vm.vmid
}

Schema

Required

  • cpus (Number) Number of vCPUs.
  • memory_mb (Number) Memory in MiB, e.g. 4096.
  • name (String) Hostname of the VM. Changing it creates a new VM.
  • template (String) Id of the OS template to clone, from the rso_instance_templates data source. Changing it creates a new VM.

Optional

  • description (String) Free-text description.
  • password (String, Sensitive) Password for the default user through cloud-init. Prefer ssh_public_key.
  • root_disk_gb (Number) Root disk size in GiB. Default 20. Can only grow.
  • ssh_public_key (String) SSH public key installed for the default user through cloud-init.

Read-Only

  • id (String) The ID of this resource.
  • node (String) Hypervisor node the VM runs on.
  • status (String) Power state: running or stopped.
  • vmid (Number) Numeric id of the VM.

Import

Import is supported using the following syntax:

# Import an existing VM by its numeric id.
terraform import rso_instance.vm 1234