Everything in this section is defined in
point-out/infrastructure and applied by GitHub
Actions with OpenTofu, to one AWS account per environment.
Architecture
The OpenTofu state and the pipeline's input variables live in a separate state account. The
repository has no backend block; the pipeline writes one at run time. The pipeline assumes its
roles with GitHub OIDC, so no AWS keys are stored in GitHub.
Accounts
| Account | ID | Holds |
|---|---|---|
| State | 266408866278 | the state bucket terraform-state-266408866278 (key <env>/terraform.tfstate, S3 native locking) and the pipeline's inputs under SSM /terraform/<env>/ |
| Staging | 468351713122 | the staging environment |
| Production | not created yet | the production environment |
Each environment account gets these settings from main.tf:
| Resource | Setting |
|---|---|
aws_iam_account_alias.main | point-out-<env>-v2, so the console sign-in URL names the environment |
aws_uxc_account_customizations.main | console colour green for staging and yellow for production; only eu-central-1 and us-east-1 in the region list |
Providers
| Provider | Version | Use |
|---|---|---|
hashicorp/aws | 6.67.0 | default region eu-central-1; alias aws.us_east_1 for resources AWS only accepts there, such as CloudFront certificates |
integrations/github | 6.13.0 | authenticates as the terraform-point-out GitHub App on the point-out organization, for the GitHub resources a deploy needs |
hashicorp/tls | 4.4.1 | generates key pairs, such as deploy keys |
hashicorp/random | 3.7.2 | generates secrets, such as the lambda-ts origin secret |
OpenTofu >= 1.13.0 is required. Both AWS providers tag every resource Environment,
Project = point-out and ManagedBy = opentofu.
Prerequisites
The stack doesn't create the following. They must exist before the first apply of a new environment.
| What | Where |
|---|---|
Role terraform-<env>-action-role, assumable with GitHub OIDC, with access to the state bucket and the parameters | state account |
SecureString /terraform/<env>/github_app_pem_file: the private key of the terraform-point-out GitHub App | state account |
GitHub OIDC provider token.actions.githubusercontent.com (the stack reads it with a data source) | environment account |
Role terraform, assumable with GitHub OIDC | environment account |
The terraform-point-out GitHub App (ID 1174609) installed on the point-out organization (installation 62473297) | GitHub |
Deployment
Workflows
| Workflow | Runs on | Does |
|---|---|---|
checkov.yml | pull requests to staging and main, or by hand | Checkov static analysis; any finding fails it. Skips are inline #checkov:skip=<id>: <reason> comments |
plan.yml | pull requests to main, or by hand | a production plan; off (if: false) |
apply.yml | push to staging, or by hand | plan and apply the branch's environment; a manual run on any other branch does nothing |
trigger-apply.yml | repository_dispatch of type trigger-apply | starts apply.yml on the branch in the payload (client_payload.branch, only staging for now) |
tofu.yml | called by plan.yml and apply.yml | the reusable job that runs OpenTofu (see below) |
A trigger-apply repository dispatch asks for an apply from outside this repository, through the
GitHub API. A repository_dispatch always runs on the default branch, so trigger-apply.yml starts
apply.yml on the payload's branch, where github.ref_name matches the environment. The payload
is { branch, repository, sha }. Only branch affects what runs; repository and sha appear in
the run name.
A run of tofu.yml
The job runs in the GitHub environment of the same name, one run at a time per environment (concurrency group
tofu-<env>, cancel-in-progress: false).
- Checkout and tools. OpenTofu
1.13.x(no wrapper) and tf-summarizev0.3.20. Every action is pinned to a commit SHA. - Credentials, backend and variables.
codingducksrl/setup-tofuassumesterraform-<env>-action-rolein the state account andterraformin the environment account, both straight from the job's OIDC token (no role chaining). It writes the S3 backend totfw_backend_override.tf(gitignored) and exports every parameter under/terraform/<env>/asTF_VAR_<name>, masking the SecureStrings.github_app_pem_fileis set this way. - Plan.
tofu init, thentofu plan -var-file=<env>.tfvars -out plan.bin. The non-secret values come from the committed tfvars, the secret one from SSM. - Summary. The plan's resource summary goes to the log and the job summary;
plan.binandplan.jsonare gitignored because they hold variable values in plain text. - Apply.
tofu apply plan.bin, only when called withapply: true, which isapply.yml.
How a change reaches an environment
Merging into staging applies staging. Promoting staging into main will plan production on
the pull request and apply it on merge, once production is on.
Production
Production is disabled until its account exists. To enable it:
- Create the account and its prerequisites, with
productionas<env>. - In
apply.yml, addmaintoon.push.branchesand to the job'sif, and replacePRODUCTION_ACCOUNT_IDwith the account ID. - In
plan.yml, dropif: falseand replacePRODUCTION_ACCOUNT_ID. - In
trigger-apply.yml, letmainthrough the job'sif. - After the first apply, delegate the zone as described in DNS.