Example: digitalocean-shc
terraform/examples/digitalocean-shc builds droplets in one region and
hands the cluster a digitalocean connection that can serve DNS, a load
balancer and block volumes from one token. Cloudflare can take DNS instead.
What differs
Section titled “What differs”modules/shc/digitaloceantakes asizeper group and animage. The region scopes the VPC and the reserved IPs, so there is one region.shc_connection "digitalocean"carries the same token the provider uses, passed again asTF_VAR_do_token, plus the region. Itszonesis empty when Cloudflare does DNS.shc_config.platformaddsstorage.volumes.provider: digitalocean, so the cluster’s volumes are DigitalOcean block storage.- The README applies in two steps:
-target=module.shcfirst for the substrate and bootstrap, then everything.
resource "shc_connection" "digitalocean" { name = "digitalocean" type = "digitalocean" credentials = { token = var.do_token region = module.shc.region } zones = local.dns_is_do ? [var.dns_zone] : [] depends_on = [module.shc]}Running it
Section titled “Running it”DIGITALOCEAN_TOKEN, TF_VAR_do_token and TF_VAR_dns_token come from the
environment.
tofu -chdir=learn/shc/terraform/examples/digitalocean-shc inittofu -chdir=learn/shc/terraform/examples/digitalocean-shc apply -var dns_zone=example.com -target=module.shctofu -chdir=learn/shc/terraform/examples/digitalocean-shc apply -var dns_zone=example.comtofu -chdir=learn/shc/terraform/examples/digitalocean-shc destroy -var dns_zone=example.comThis page was not walked: no DigitalOcean credential is on the learning workstation. Track F’s DigitalOcean page covers the same account through the CLI.
Next: Example: linode-shc.
shc@docs:~$