Component ยท Shared or other
terraform-apply.sh layer apply (manual)
What it is
Terraform changes to the infrastructure are applied by a person running terraform-apply.sh, one layer at a time, on the matching environment branch. Nothing in CI runs terraform apply. The script downloads the module version the layer pins, resolves its secrets from Bitwarden, runs Terraform and removes the secrets from the machine at the end.
Like a pilot flying the landing by hand with a checklist: autopilot is deliberately switched off for this part.
Why it exists
Infrastructure changes can destroy data or take a cluster down. A manual apply with a plan review at the end keeps a human in front of each change.
How it works
- Change a reusable module: open a pull request against main (checked with terraform fmt, TFLint and a Trivy infrastructure scan), merge it and cut a vX.Y.Z tag.
- Open pull requests against each environment branch (dev, stage, prod, stage-v2, prod-v2, prod-v2-eu) that change terraform/deployments/<layer>, including the base.version file that pins the module tag. Roll the change dev, then stage, then prod by hand.
- On the right host, run ./terraform-apply.sh --layer <layer>. For dev that is a laptop on VPN. For stage and prod, cloud-infra and cloud-bedrock run from a laptop, while the cluster and oc-setup layers run from the matching plane's bastion (or from a laptop with the --local option, which tunnels through that bastion).
- The script vendors the pinned tag, signs in to Bitwarden, turns the layer's secrets.yaml into variables, then runs terraform get, init, validate and apply.
- The person reads the plan before typing yes, then checks the result and runs again to confirm the follow-up plan is empty.
Identity and access
Secrets come from Bitwarden (SSO login on a laptop, an API key on a bastion). AWS credentials for the layer's AWS account assume the layer's Terraform role.
Key facts
- Script
- terraform-apply.sh --layer <layer>
- Module tags
- vX.Y.Z, pinned per layer in base.version
- Layers
- cloud-infra, cloud-cluster-k8s-cp, cloud-cluster-k8s-dp, oc-setup-cp, oc-setup-dp, cloud-bedrock
- Secrets
- Resolved from Bitwarden, scrubbed on exit
- Automation
- None: nothing in CI applies these layers
- Promotion between environments
- By hand: the same change is a pull request to each environment branch
- Namespace
- bastion or laptop
Talks to (1)
- reads from Terraform module tags vX.Y.Z base.version pins the module tag per layergit tag checkout