Skip to content
SHC Docs

Example: openstack-shc

terraform/examples/openstack-shc builds a cluster on an OpenStack project such as OVH’s. There is no Designate there, so DNS goes through Cloudflare, and every platform resource has count = 0 until vault_pw is set, so the same root does an infra-only apply and a full one.

  • modules/shc/openstack takes external_network_name, availability_zone, an image_name and a flavor_name per group. networking carries only the subnet.
  • The provider block authenticates with an application credential, passed as two variables, plus auth_url and region.
  • local.platform_enabled is true while vault_pw is empty, so count = local.platform_enabled ? 0 : 1 on shc_connection, shc_config, shc_repo and both deployments creates them only once a password is set.
provider "openstack" {
auth_url = var.auth_url
region = var.region
application_credential_id = var.openstack_application_credential_id
application_credential_secret = var.openstack_application_credential_secret
}
resource "shc_connection" "dns" {
count = local.platform_enabled ? 0 : 1
name = var.dns_provider
type = var.dns_provider
credentials = { token = var.dns_token }
zones = [var.dns_zone]
depends_on = [module.shc]
}

TF_VAR_openstack_application_credential_id, TF_VAR_openstack_application_credential_secret and TF_VAR_dns_token come from the environment; auth_url, region, the image, flavour and zone in a tfvars.

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

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

This is the last page of the track. Every root under terraform/examples now has a page; the module library’s two other front doors, hostinger and proxmox, appear through proxmox-lan and mixed-proxmox-hetzner, and hostinger has no example root yet.