feat(terraform): reusable module for deploying the broker Lambda - #25
Merged
Merged
Conversation
Ships a first-party Terraform module under `terraform/` that provisions
the published `github-token-broker` release as an AWS Lambda, including
least-privilege IAM, a managed CloudWatch log group, and an optional
Function URL (AWS_IAM auth only).
Three ways to source the zip via the `lambda_artifact` input:
- `release_version` — `null_resource` + `local-exec` runs
`gh release download` on the apply host and verifies the zip against
`checksums.txt` before Terraform consumes it.
- `lambda_zip_path` — pre-downloaded zip for air-gapped flows.
- `lambda_source_s3` — S3 bucket/key when the zip is staged out-of-band.
Inline SHA256 verification is defense-in-depth; `gh attestation verify`
remains the canonical supply-chain check and is documented prominently
in `terraform/README.md`.
Also amends the release pipeline to upload `dist/checksums.txt` as a
release asset (prerequisite for inline verification), extends dependabot
to the terraform ecosystem, and adds a CI workflow with fmt, matrix
validate, tflint (AWS ruleset), trivy config scan, and terraform-docs
sync check — all SHA-pinned with top-level `permissions: {}`.
Examples: `basic`, `function-url` (with principal-scoped invoker
permission), and `with-ssm-bootstrap` (gated SSM parameter creation for
first-time setup).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The terraform-docs CI action (v1.4.1) bundles terraform-docs v0.20.0; v0.20.0 emits the version constraint in the Providers table, while v0.21.0 emits the resolved pinned version. Regenerated locally with v0.20.0 so the docs sync check passes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
terraform/that provisions the publishedgithub-token-brokerrelease as an AWS Lambda, with least-privilege IAM, a managed CloudWatch log group, and an optionalAWS_IAM-auth Function URL.reusable-release.ymlto uploaddist/checksums.txtas a release asset (prerequisite for the module's inline SHA256 verification on download).terraformecosystem and adds.github/workflows/terraform.yml(fmt, matrix validate, tflint with AWS ruleset, trivy config scan, terraform-docs sync check) — all actions SHA-pinned, top-levelpermissions: {}.Three ways to source the Lambda zip via
lambda_artifact:release_version = "v1.0.0"gh release download+sha256sum --checkon apply.lambda_zip_pathlambda_source_s3Validation enforces exactly one is set.
Examples shipped:
basic(smallest viable config),function-url(Function URL + principal-scoped invoker permission),with-ssm-bootstrap(gated SSM parameter creation for first-time setup).Inline SHA256 verification is defense-in-depth;
gh attestation verifyremains the canonical supply-chain check, documented prominently interraform/README.md.checksums.txtwill be present on all releases shipping from this PR onwards.Executes Phase 5 of
.journal/PLAN.md.Test plan
Local validation performed on this branch:
tofu fmt -check -recursive— cleantofu init -backend=false && tofu validate— module and all three examplestflint --init && tflint --recursivewith AWS ruleset v0.47.0 — no findingstrivy config --severity HIGH,CRITICAL .— 0 misconfigurationsterraform-docs markdown table --output-check— README in syncTo be verified in CI by the new
terraform.ymlworkflow:Deferred follow-ups (tracked in PLAN.md open threads):
examples/basic— procedure documented interraform/README.md; execute when a sandbox account is available.terraformskill grounded in lessons from this phase.🤖 Generated with Claude Code