# Input variables variable "vultr_api_key" { type = string description = "Vultr API key." } variable "tld" { type = string description = "Root Top-Level Domain. Subdomains will be derived from it." } variable "hostname" { type = string description = "Human name of the host. This is a pet name, not cattle name :)" } # Vultr provider "vultr" { api_key = var.vultr_api_key version = "~> 1.3" } # Instance resource "vultr_server" "vps_server" { enable_ipv6 = true notify_activate = true hostname = var.hostname label = var.hostname # $ curl https://api.vultr.com/v1/regions/list | jq '.["9"]' region_id = 9 # $ curl https://api.vultr.com/v1/plans/list?type=vc2 | jq '.["201"]' plan_id = 201 # $ curl -H "API-Key: $TF_VAR_vultr_api_key" https://api.vultr.com/v1/snapshot/list | jq snapshot_id = "c565f318e4aea" } output "public_ip" { value = vultr_server.vps_server.main_ip } # DNS and IP configuration resource "vultr_dns_domain" "vps_tld" { # The CNAME record is already generated by Vultr domain = var.tld server_ip = vultr_server.vps_server.main_ip }