2017-02-09 04:53:24 +00:00
|
|
|
# Proxmox 4 Terraform
|
|
|
|
|
|
|
|
Terraform provider plugin for proxmox
|
|
|
|
|
2017-02-09 21:36:31 +00:00
|
|
|
|
2017-02-14 22:52:42 +00:00
|
|
|
## Working prototype
|
2017-02-09 21:36:31 +00:00
|
|
|
|
2017-02-09 04:53:24 +00:00
|
|
|
## Build
|
|
|
|
|
2017-02-09 21:39:14 +00:00
|
|
|
Requires https://github.com/Telmate/proxmox-api-go
|
|
|
|
|
2017-02-09 04:53:24 +00:00
|
|
|
```
|
|
|
|
go build -o terraform-provider-proxmox
|
2017-02-09 21:39:14 +00:00
|
|
|
cp terraform-provider-proxmox $GOPATH/bin
|
2017-02-09 04:53:24 +00:00
|
|
|
```
|
|
|
|
|
2017-02-14 22:52:42 +00:00
|
|
|
Recommended ISO builder https://github.com/Telmate/terraform-ubuntu-proxmox-iso
|
|
|
|
|
|
|
|
|
2017-02-09 21:36:31 +00:00
|
|
|
## Run
|
|
|
|
|
|
|
|
```
|
|
|
|
terraform apply
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample file
|
|
|
|
|
|
|
|
main.tf:
|
|
|
|
```
|
|
|
|
provider "proxmox" {
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "proxmox_vm_qemu" "test" {
|
|
|
|
name = "tftest1.xyz.com"
|
|
|
|
desc = "tf description"
|
|
|
|
target_node = "proxmox1-xx"
|
2017-02-11 00:06:14 +00:00
|
|
|
|
2017-02-09 21:36:31 +00:00
|
|
|
clone = "terraform-ubuntu1404-template"
|
|
|
|
storage = "local"
|
|
|
|
cores = 3
|
|
|
|
sockets = 1
|
|
|
|
memory = 2560
|
2017-02-10 19:43:21 +00:00
|
|
|
disk_gb = 4
|
|
|
|
nic = "virtio"
|
|
|
|
bridge = "vmbr1"
|
2017-02-11 00:06:14 +00:00
|
|
|
ssh_forward_ip = "10.0.0.1"
|
|
|
|
ssh_user = "terraform"
|
|
|
|
ssh_private_key = <<EOF
|
|
|
|
-----BEGIN RSA PRIVATE KEY-----
|
|
|
|
private ssh key terraform
|
|
|
|
-----END RSA PRIVATE KEY-----
|
|
|
|
EOF
|
|
|
|
|
|
|
|
os_type = "ubuntu"
|
2017-02-10 19:43:21 +00:00
|
|
|
os_network_config = <<EOF
|
|
|
|
auto eth0
|
|
|
|
iface eth0 inet dhcp
|
|
|
|
EOF
|
2017-02-09 21:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|