Skip to content

Add AWS Terraform recipes extracted from bootstrapper#37

Open
paribaker wants to merge 17 commits into
mainfrom
feature/aws-pipeline
Open

Add AWS Terraform recipes extracted from bootstrapper#37
paribaker wants to merge 17 commits into
mainfrom
feature/aws-pipeline

Conversation

@paribaker

@paribaker paribaker commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extracted 6 shell scripts from tn-spa-bootstrapper template into reusable justfile recipes under [aws-terraform] group
  • Added aws-setup-vpc recipe for idempotent shared VPC creation with tagged resources
  • All 7 recipes grouped under [aws-terraform] in logical order: VPC > backend > OIDC/secrets > operational tools
  • Default tn --list now uses --unsorted to preserve source ordering

Recipes

Recipe Description
aws-setup-vpc Idempotent shared VPC creation with tagged resources
aws-tf-setup-backend S3 + DynamoDB backend creation
aws-tf-init-backend Terraform backend initialization
aws-setup-oidc GitHub OIDC role provisioning
aws-setup-secrets S3 secrets bucket creation
aws-ecs-exec Interactive ECS container exec session
aws-stream-logs CloudWatch log streaming

Test Plan

  • tn --list shows all 7 recipes under [aws-terraform] group
  • Group ordering is logical (VPC first, then backend, then OIDC/secrets, then ops tools)
  • No AWS Terraform recipes appear outside the group
  • No jinja template syntax in recipe code
  • Each recipe accepts project-specific values as parameters
  • All recipes are idempotent (check-before-create pattern)
  • Spec parser continues to function (spekk next)

Specs Addressed

  • Assertion: specs/aws-terraform-recipes/assertions/cli-script-recipes.md (done)
  • Assertion: specs/aws-terraform-recipes/assertions/cli-recipe-group-listing.md (done)
  • Parent Spec: specs/aws-terraform-recipes/aws-terraform-recipes.md

🤖 Generated with Claude Code

Pari Work Temp and others added 17 commits March 21, 2025 13:36
Declare 3 assertions for extracting generic AWS infrastructure scripts
from tn-spa-bootstrapper into tn-cli justfile recipes: VPC recipe
(aws-setup-vpc), 6 script recipes (ecs-exec, stream-logs, tf-setup-backend,
tf-init-backend, setup-oidc, setup-secrets), and recipe group listing
under [aws-terraform]. Cross-repo dependency from bootstrapper's
aws-fargate-infra-refactor spec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract 6 scripts from tn-spa-bootstrapper template into reusable
justfile recipes under [aws-terraform] group. All recipes accept
parameters instead of cookiecutter template variables and contain
no jinja syntax.

Recipes added:
- aws-ecs-exec: Interactive ECS container exec session
- aws-stream-logs: CloudWatch log streaming
- aws-tf-setup-backend: S3 + DynamoDB backend creation
- aws-tf-init-backend: Terraform backend initialization
- aws-setup-oidc: GitHub OIDC role provisioning
- aws-setup-secrets: S3 secrets bucket creation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Script Recipes: Six Extracted Operations Exist as tn-cli Recipes
- Add aws-setup-vpc recipe for idempotent shared VPC creation
- Reorder aws-terraform recipes: VPC > backend > OIDC/secrets > ops tools
- Use --unsorted in default list for source-order display
- All 7 recipes grouped under [aws-terraform]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Per-project OIDC roles and repo-scoped trust policies for
aws-setup-oidc. Assertions 1 & 3 active, resource scoping (2) draft.
Add required `service` parameter to `aws-setup-oidc` recipe. Role name
now follows `github-actions-<service>-<environment>` pattern, giving each
project its own isolated IAM role. Policy names updated accordingly.
Output prints role ARN for environments.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
OIDC Role Is Per-Project-Per-Environment
Scope OIDC trust policy to specific GitHub repo instead of entire org.

- Add optional `repo` parameter to aws-setup-oidc (defaults to github_org/service)
- Trust policy StringLike condition now uses `repo:<org>/<repo>:*` instead of `repo:<org>/*:*`
- Existing role updates append repo conditions additively (idempotent)
- Output confirms which specific repo was added to trust policy

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
aws-setup-secrets used `github-actions-${ENVIRONMENT}` but aws-setup-oidc
creates `github-actions-${SERVICE}-${ENVIRONMENT}`. This caused
"Invalid principal" when PutBucketPolicy tried to reference a non-existent
role ARN.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Role ARNs go in .github/environments.json, not as separate
per-environment GitHub Actions variables. The old pattern
(DEVELOPMENT_AWS_ROLE_ARN, etc.) is no longer used by the
deploy workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GitHub OIDC tokens now include numeric IDs in the sub claim:
repo:org@12345/repo@67890:ref:refs/heads/main

Use wildcards (org*/repo*) to match both old and new formats.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace heredoc with printf to avoid inconsistent leading whitespace
that breaks just's recipe parser.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant