Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Complete Virtual Machine Deployment

This example demonstrates most of the working configurations you can give to a virtual machine. Within locals.tf, there's a long list of variables and what said variable does.

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

Once you've populated the required variables in terraform.tfvars, you may open locals.tf to see all of the variables you may modify.

Step 4. Deploy Virtual Machine

Run the following commands to deploy said Virtual Machine

terraform init
terraform plan
terraform apply

Complete Virtual Machine Deployment 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 for the Virtual Machine. 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.