Vultr
Reference for provisioning and managing Vultr Cloud Compute with Terraform and the Vultr API. Vultr is an official partner. The version-pinned, authoritative resource and data-source reference is synced intoterraform-providers/vultr/. This page is the curated overview and best-practice index.
Provider
api_keyshould be supplied via theVULTR_API_KEYenvironment variable, never written into HCL or committed state.rate_limit(ms between calls) andretry_limittune behavior against Vultr’s 30 calls/sec ceiling.
Core resources for VPS provisioning
Useful data sources:
vultr_os (resolve os_id), vultr_plan, vultr_region, vultr_reserved_ip.
Best practices and gotchas
- Cloud-init via raw
user_data. Linux instances consume cloud-init user-data. The provider base64-encodesuser_datainternally - pass raw cloud-config, do notbase64encode()it. - Create-only fields force an OS REINSTALL (data loss). Changing
hostname,user_data,os_id, orssh_key_idson an existingvultr_instancetriggers an in-place reinstall that wipes the disk. Guard them withlifecycle { ignore_changes = [hostname, user_data, os_id] }and use an explicit taint/replace for an intentional rebuild. - Stable IP across reinstall. Create a
vultr_reserved_ipand attach it viavultr_instance.reserved_ip_idso the address survives an OS reinstall (and any IP-bound licensing). Express the attach on the instance side only to avoid a dependency cycle; the IPv4 is exported as.subnet. - Resolve
os_iddeliberately. Look it up with thevultr_osdata source or pin a known id; ids are stable but vary per image. - Firewall is inbound-only and stateful. No egress rules. One firewall group per instance; v4 and v6 are separate
vultr_firewall_ruleresources. A passive-port range is expressible as a single rule (e.g.49152:65534). - Region availability is plan-gated. Not every plan exists in every region - confirm plan availability per region before pinning.
- Pricing is globally flat. Vultr
monthly_costis a single value per plan with no regional variance.
Related
- Authoritative, version-pinned provider reference:
terraform-providers/vultr/ - WHMCS VPS modules: under development (multi-cloud provisioning)