Example: gcp-shc
terraform/examples/gcp-shc builds a Google Cloud cluster and pins the
module library to a published version with module_version. The platform
is wired the same way as the Azure root: a DNS connection, one config
document, the catalogue, Postgres and Gitea.
What differs
Section titled “What differs”modules/shc/gcptakes azone, amachine_typeper group and aroot_volumewith a GCE disk type.networking.ip_rangeis accepted and ignored: a custom-mode network has no range of its own, only the subnet.sourceis.../shc-gcp-${var.module_version}.tgz, so a variable chooses the module release. The ladder’ssourcewas a path in the checkout.- Google’s own startup script preps the nodes; the provider’s SSH engine waits for it before installing shc by apt.
module "shc" { source = "https://selfhostedcloud.org/terraform/0.1/modules/${var.module_version}/shc-gcp-${var.module_version}.tgz"
cluster_name = var.cluster_name zone = var.zone ssh_public_key = tls_private_key.cluster.public_key_openssh node_groups = { control = { count = var.node_count, machine_type = var.machine_type, runtime = "docker", control_plane = true } } root_volume = { size = 100, type = "pd-balanced" }}Running it
Section titled “Running it”GOOGLE_APPLICATION_CREDENTIALS points at an administrator’s key file;
TF_VAR_project, TF_VAR_dns_zone, TF_VAR_dns_token and TF_VAR_acme_email
come from the environment. The example ships registry.tfrc; select it with
TF_CLI_CONFIG_FILE or keep the ~/.tofurc from page 00.
tofu -chdir=learn/shc/terraform/examples/gcp-shc inittofu -chdir=learn/shc/terraform/examples/gcp-shc applytofu -chdir=learn/shc/terraform/examples/gcp-shc destroyThis page was not walked: labs run on the learning project at Hetzner only. Track F’s GCP page covers the same account through the CLI.
Next: Example: digitalocean-shc.
shc@docs:~$