Skip to content
SHC Docs

Example: azure-shc

terraform/examples/azure-shc builds three nodes in one Azure resource group and wires the platform with root-level resources: a DNS connection, one config document, the public catalogue, and Gitea integrated with Postgres.

  • modules/shc/azure takes admin_username, a size per group and a root_volume with an Azure disk type. create_ssh_key = true as in the ladder, and ssh = { user = var.admin_username }.
  • The DNS connection’s credentials are either a Cloudflare token or the same service principal Terraform runs as, picked by dns_provider.
  • shc_deployment "gitea" is public, has a route, and integrate = { postgres = { stack = shc_deployment.postgres.stack } } binds it to the Postgres deployment the way -i postgres=db does on the CLI.
resource "shc_deployment" "gitea" {
tenant = shc_tenant.apps.name
repo = shc_repo.shc.name
app = "gitea"
stack = "gitea"
public = true
routes = { "git.${var.dns_zone}" = { service = "gitea", port = 3000 } }
wait_healthy = true
integrate = { postgres = { stack = shc_deployment.postgres.stack } }
depends_on = [shc_deployment.postgres, shc_config.platform]
}

ARM_SUBSCRIPTION_ID, ARM_TENANT_ID, ARM_CLIENT_ID and ARM_CLIENT_SECRET for a service principal, TF_VAR_dns_token, TF_VAR_vault_password and TF_VAR_dns_zone come from the environment.

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

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

Next: Example: gcp-shc.