Skip to content
SHC Docs

Example: exoscale-shc

terraform/examples/exoscale-shc builds a cluster in one Exoscale zone. Exoscale has no region layer and its DNS is a paid add-on, so the zone is the only placement axis and Cloudflare serves DNS.

  • modules/shc/exoscale takes a zone, a type per group and a root_volume size. The example makes the worker group conditional on worker_node_count, with merge() over two maps.
  • The hosts are derived in locals: cloud.<cluster>.<zone> is the cluster host the daemon registers itself, whoami.<cluster>.<zone> the demo app.
  • The private key is also written to a file with local_sensitive_file, as page 02 did, at .ssh/cluster inside the root.
module "shc" {
source = var.module_source
cluster_name = var.cluster_name
zone = var.zone
ssh_public_key = tls_private_key.cluster.public_key_openssh
node_groups = merge(
{ compose = { count = 1, type = var.node_type, runtime = "docker" } },
var.worker_node_count > 0 ? { workers = { count = var.worker_node_count, type = var.node_type, runtime = "docker" } } : {}
)
root_volume = { size = var.root_volume_size }
}

TF_VAR_exoscale_api_key, TF_VAR_exoscale_api_secret, TF_VAR_dns_token, TF_VAR_dns_zone and TF_VAR_acme_email come from the environment.

Terminal window
tofu -chdir=learn/shc/terraform/examples/exoscale-shc init
tofu -chdir=learn/shc/terraform/examples/exoscale-shc apply
tofu -chdir=learn/shc/terraform/examples/exoscale-shc destroy

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

Next: Example: alibaba-shc.