What is Terraform

Terraform is an open-source infrastructure as code (IaC) tool created by HashiCorp. It enables users to define and provision infrastructure using Hashicorp Configuration Language (HCL). It provides a consistent CLI workflow and state management to manage and version infrastructure deployments in a safe and efficient manner.

Register to our UII Service

You need to register an account to our UII service. After registering you can create an API token.

Register Now

This token is used by terraform to authenticate against our service to generate images for you.

How to use Virtomize UII Terraform provider

You need to install terraform first.

Basic Example

You can find more examples in our github repo.

Including examples for installing virtual machines on vmware, proxmox and xen hypervisors.

define your variables

terraform.tfvars


virtomize_api_token = ""

`

define your terraform file

virtomize.tf


# configure virtomize token
variable "virtomize_api_token" {
  type    = string
}

terraform {
required_providers {
    virtomize = {
      source  = "virtomize.com/uii/virtomize"
        }
  }
}

# define localstorage
provider "virtomize" {
  apitoken = "${var.virtomize_api_token}"
  localstorage = "/path/to/store/your/iso"
}

# get your iso
resource "virtomize_iso" "debian_iso" {
    name = "debian_iso"
    distribution = "debian"
    version = "11"
    hostname = "examplehost"
    networks = [{
      dhcp = true
      no_internet = false
  }]
}

Run terraform init to init your providers.

Run terraform validate and terraform plan to test your configuration.

Validate will check if your image configuration is correct, while plan simulates a terraform run.

Use terraform apply to let terraform do it’s magic.

You can use ${resource.virtomize_iso.debian_iso.path} to access your image within other terraform provider.