Skip to content
SHC Docs

Example: vultr-shc

terraform/examples/vultr-shc mirrors a live Vultr estate: one node in the group the root names compose and three workers, a vultr connection that serves the load balancer and block volumes, and Cloudflare for DNS because Vultr DNS cannot host a subdomain zone.

  • modules/shc/vultr takes a plan per group and an os_name.
  • Two connections: vultr with the API key and region for proxy and volumes, and dns with the Cloudflare token for the zone.
  • shc_config.platform sets storage.volumes.provider: vultr beside the DNS and ACME keys.
  • The public route on whoami is written as routes = { "whoami.${var.dns_zone}" = {} }: an empty route takes the app’s one exposed port.
resource "shc_connection" "vultr" {
name = "vultr"
type = "vultr"
credentials = {
api_key = var.vultr_api_key
region = module.shc.region
}
depends_on = [module.shc]
}
resource "shc_deployment" "whoami" {
tenant = shc_tenant.apps.name
repo = "shc"
app = "whoami"
stack = "whoami"
public = true
routes = { "whoami.${var.dns_zone}" = {} }
wait_healthy = true
depends_on = [shc_repo.shc]
}

VULTR_API_KEY, TF_VAR_vultr_api_key and TF_VAR_dns_token come from the environment; dns_zone, cluster_name and acme_email on the command line.

Terminal window
tofu -chdir=learn/shc/terraform/examples/vultr-shc init
tofu -chdir=learn/shc/terraform/examples/vultr-shc apply -var dns_zone=example.com -var cluster_name=shc-vultr -var [email protected]
tofu -chdir=learn/shc/terraform/examples/vultr-shc destroy -var dns_zone=example.com -var cluster_name=shc-vultr -var [email protected]

This page was not walked: no Vultr credential is on the learning workstation. Track F’s Vultr page covers the same account through the CLI.

Next: Example: exoscale-shc.