Skip to content

sreway/terraform-proxmox-example

Repository files navigation

Example usage Proxmox Terraform Provider

This repository contains examples Terraform and Ansible configurations to launch and set up Docker in QEMU Virtual Machine on PVE.

Requirements

Dependencies

Providers

Name Version
local n/a
null n/a
proxmox n/a

Inputs

Name Description Type Default Required
ci_password Default cloud-init password. string n/a yes
ci_user Default cloud-init username. string n/a yes
pm_ip Proxmox Managment IP address. string n/a yes
pm_parallel Allowed simultaneous Proxmox processes. number 1 no
pm_password Proxmox Managment Password. string n/a yes
pm_timeout Timeout value (seconds) for Proxmox API calls. number 400 no
pm_user Proxmox Managment User. string n/a yes
ssh_keys SSH Public keys. string n/a yes
vms_data List of Qemu Virtual Machine.
list(object({
name = string
target_node = string
clone = string
os_type = string
cores = number
sockets = number
memory = number
scsihw = string
bootdisk = string

disks = list(object({
id = number
size = string
type = string
storage = string
storage_type = string
}))

networks = list(object({
id = number
model = string
bridge = string
ci_network = string
}))

nameservers = list(string)

}))
[
{
"bootdisk": "scsi0",
"clone": "centos-base-system",
"cores": 4,
"disks": [
{
"id": 0,
"size": "40G",
"storage": "local-lvm",
"storage_type": "lvm",
"type": "scsi"
},
{
"id": 1,
"size": "30G",
"storage": "local-lvm",
"storage_type": "lvm",
"type": "scsi"
}
],
"memory": 2048,
"name": "centos-7-testing",
"nameservers": [
"10.128.4.127",
"192.168.13.27"
],
"networks": [
{
"bridge": "vmbr0",
"ci_network": "ip=192.168.10.192/24,gw=192.168.11.1",
"id": 0,
"model": "virtio"
},
{
"bridge": "vmbr0",
"ci_network": "ip=192.168.10.193/24,gw=192.168.11.1",
"id": 1,
"model": "virtio"
}
],
"os_type": "l26",
"scsihw": "virtio-scsi-pci",
"sockets": 1,
"target_node": "pve"
}
]
no

Terraform VM Qemu Resource: doc

Outputs

Name Description
hosts SSH hosts

Usage

  • Clone this repo.

  • Install Ansible role dependencies.

ansible-galaxy install -r requirements.yml -p ./roles
  • Install Terraform Provider Proxmox
go get -v github.com/Telmate/terraform-provider-proxmox/cmd/terraform-provider-proxmox
go get -v github.com/Telmate/terraform-provider-proxmox/cmd/terraform-provisioner-proxmox
go install -v github.com/Telmate/terraform-provider-proxmox/cmd/terraform-provider-proxmox
go install -v github.com/Telmate/terraform-provider-proxmox/cmd/terraform-provisioner-proxmox
cp $GOPATH/bin/terraform-provider-proxmox ~/.terraform.d/plugins
cp $GOPATH/bin/terraform-provisioner-proxmox ~/.terraform.d/plugins
  • Run terraform, it will create a QEMU virtual machines, inventory file (example) and deploy environment:
terraform init
terraform plan -var-file=example.tfvars
terraform apply -var-file=example.tfvars

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published