Point-out Docs

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

AccountIDHolds
State266408866278the state bucket terraform-state-266408866278 (key <env>/terraform.tfstate, S3 native locking) and the pipeline's inputs under SSM /terraform/<env>/
Staging468351713122the staging environment
Productionnot created yetthe production environment

Each environment account gets these settings from main.tf:

ResourceSetting
aws_iam_account_alias.mainpoint-out-<env>-v2, so the console sign-in URL names the environment
aws_uxc_account_customizations.mainconsole colour green for staging and yellow for production; only eu-central-1 and us-east-1 in the region list

Providers

ProviderVersionUse
hashicorp/aws6.67.0default region eu-central-1; alias aws.us_east_1 for resources AWS only accepts there, such as CloudFront certificates
integrations/github6.13.0authenticates as the terraform-point-out GitHub App on the point-out organization, for the GitHub resources a deploy needs
hashicorp/tls4.4.1generates key pairs, such as deploy keys
hashicorp/random3.7.2generates 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.

WhatWhere
Role terraform-<env>-action-role, assumable with GitHub OIDC, with access to the state bucket and the parametersstate account
SecureString /terraform/<env>/github_app_pem_file: the private key of the terraform-point-out GitHub Appstate account
GitHub OIDC provider token.actions.githubusercontent.com (the stack reads it with a data source)environment account
Role terraform, assumable with GitHub OIDCenvironment account
The terraform-point-out GitHub App (ID 1174609) installed on the point-out organization (installation 62473297)GitHub

Deployment

Workflows

WorkflowRuns onDoes
checkov.ymlpull requests to staging and main, or by handCheckov static analysis; any finding fails it. Skips are inline #checkov:skip=<id>: <reason> comments
plan.ymlpull requests to main, or by handa production plan; off (if: false)
apply.ymlpush to staging, or by handplan and apply the branch's environment; a manual run on any other branch does nothing
trigger-apply.ymlrepository_dispatch of type trigger-applystarts apply.yml on the branch in the payload (client_payload.branch, only staging for now)
tofu.ymlcalled by plan.yml and apply.ymlthe 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).

  1. Checkout and tools. OpenTofu 1.13.x (no wrapper) and tf-summarize v0.3.20. Every action is pinned to a commit SHA.
  2. Credentials, backend and variables. codingducksrl/setup-tofu assumes terraform-<env>-action-role in the state account and terraform in the environment account, both straight from the job's OIDC token (no role chaining). It writes the S3 backend to tfw_backend_override.tf (gitignored) and exports every parameter under /terraform/<env>/ as TF_VAR_<name>, masking the SecureStrings. github_app_pem_file is set this way.
  3. Plan. tofu init, then tofu plan -var-file=<env>.tfvars -out plan.bin. The non-secret values come from the committed tfvars, the secret one from SSM.
  4. Summary. The plan's resource summary goes to the log and the job summary; plan.bin and plan.json are gitignored because they hold variable values in plain text.
  5. Apply. tofu apply plan.bin, only when called with apply: true, which is apply.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:

  1. Create the account and its prerequisites, with production as <env>.
  2. In apply.yml, add main to on.push.branches and to the job's if, and replace PRODUCTION_ACCOUNT_ID with the account ID.
  3. In plan.yml, drop if: false and replace PRODUCTION_ACCOUNT_ID.
  4. In trigger-apply.yml, let main through the job's if.
  5. After the first apply, delegate the zone as described in DNS.

On this page