Skip to content

Latest commit

 

History

History

multiple-nics

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Multi-Nic Ubuntu Virtual Machine Deployment

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

Network Adapter net0 is set to DHCP.

Network Adapter net1 has a static IP assigned.

Network Adapter net2 has a static IP assigned, different network bridge, and has a tagged VLAN.

NOTE: If your Virtual Machine template does NOT have the Cloudinit drive set to ide2, the Terraform provider may fail to provision your Virtual Machine.

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 few network adapters residing in locals.tf. Feel free to mess around with the IP Addressing for each of the Network Adapters to understand the syntax.

Step 4. Deploy Virtual Machine

Run the following commands to deploy said Virtual Machine

terraform init
terraform plan
terraform apply

Multiple-NICs Example Information

Requirements

Name Version
terraform >=1.3.0
proxmox 2.9.14

Providers

No providers.

Modules

Name Source Version
multi_nic ../../ 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.