Pcornel
Virtualization · Automation

Terraform

Cheat sheet · https://pcornel.dk/topic.php?topic=3691

Back to the Topic

Answer

Terraform provisions VMs declaratively with providers for vSphere, Proxmox, Hyper-V, libvirt and clouds; terraform plan shows what will change, apply makes it so, and the state file tracks what Terraform manages.

Remember

  • Never edit state by hand without a backup.
  • Changing some attributes forces replace — read the plan.
  • Remote state needs locking.

First checks

  • terraform init && terraform plan — providers and plan
  • terraform state list — managed resources
  • terraform providers — bpg/proxmox, vsphere, hyperv providers

Verify in this order

HCL → provider → API → VMs → state

Where it usually breaks

First mismatch in management intent → host/cluster capability → hypervisor runtime/task → virtual resource/device → guest state → workload-visible read-back; preserve identity/native error/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3691

Confirmation

Confirm action

Continue?