first of all create user for Terraform in Proxmox and give it all permissions to create or delete resources
connect to your Proxmox machine and run these following commands and do not forget to replace and with your values
pveum role add TerraformProv -privs "VM.Allocate VM.Clone VM.Config.CDROM VM.Config.CPU VM.Config.Cloudinit VM.Config.Disk VM.Config.HWType VM.Config.Memory VM.Config.Network VM.Config.Options VM.Monitor VM.Audit VM.PowerMgmt Datastore.AllocateSpace Datastore.Audit"
pveum user add <USER>@pve --password <PASSWORD>
pveum aclmod / -user <USER>@pve -role TerraformProv
come back to your working directory that you have cloned the repository edit main.tf with your user and password values
terraform {
required_providers {
proxmox = {
source = "telmate/proxmox"
version = "2.9.0"
}
}
}
provider "proxmox" {
pm_api_url = "https://proxmox-server01.example.com:8006/api2/json"
pm_user = "<USER>@pve"
pm_password = "<PASSWORD>"
}
terraform init
terraform plan
terraform apply