Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Simple Ubuntu Cloudinit VM Deployment

This example demonstrates how you would deploy a Virtual Machine using an Ubuntu Cloudinit template.

Step 1. Configure Terraform environment variables

Example 1: Using token and secret

# Using API Token & Secret example:
export PM_API_URL="https://pve1.yourdomain.com:8006/api2/json"
export PM_API_TOKEN_ID="svc-acc-terraform@pam!svc-acc-token-id"
export PM_API_TOKEN_SECRET="12341234-1234-1234-1234-123412341234"

Example 2: Using username and password

# Using username and password example:
export PM_API_URL="https://pve1.yourdomain.com:8006/api2/json"
export PM_USER="svc-acc-terraform@pam"
export PM_PASS="proxmox_account_password"

Step 2. Modify Variables

Rename terraform.tfvars.example to terraform.tfvars. Once renamed, modify the three variables within the file to match your environment.

Step 3. Modify Virtual Machine configuration

I've pre-configured a network adapter residing in locals.tf. Feel free to change the settings of said adapter to get a feel of the syntax.

Step 4. Deploy Virtual Machine

Run the following commands to deploy said Virtual Machine

terraform init
terraform plan
terraform apply

Simple Virtual Machine Example Information

Requirements

Name Version
terraform >=1.3.0
proxmox 2.9.14

Providers

No providers.

Modules

Name Source Version
cloudinit_vm ../../ n/a

Resources

No resources.

Inputs

Name Description Type Default Required
clone The base VM from which to clone to create the new VM. Note that clone is mutually exclussive with pxe and iso modes. string n/a yes
storage_location The storage location where your Virtual Machine will reside. string n/a yes
target_node The name of the Proxmox Node on which to place the VM. string n/a yes

Outputs

Name Description
disks The Disk(s) affiliated with said Virtual Machine.
ip The Virtual Machine's IP on the first Network Adapter.
name The Virtual Machine's name.
nics The Network Adapter(s) affiliated with said Virtual Machine.
node The Proxmox Node the Virtual Machine was created on.
ssh The Virtual Machine's SSH Settings.
template The name of the template in which the Virtual Machine was created on.
vmid The Virtual Machine's Id.