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.
What differs
Section titled “What differs”modules/shc/openstacktakesexternal_network_name,availability_zone, animage_nameand aflavor_nameper group.networkingcarries only the subnet.- The provider block authenticates with an application credential, passed as
two variables, plus
auth_urlandregion. local.platform_enabledis true whilevault_pwis empty, socount = local.platform_enabled ? 0 : 1onshc_connection,shc_config,shc_repoand 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]}Running it
Section titled “Running it”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.
tofu -chdir=learn/shc/terraform/examples/openstack-shc inittofu -chdir=learn/shc/terraform/examples/openstack-shc applytofu -chdir=learn/shc/terraform/examples/openstack-shc destroyThis 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.