Add team-scoped Terraform backend access to CI team roles#91
Merged
Conversation
Team roles need access to the shared state bucket and lock table.
- S3: scoped to apps/{team}/* prefix (can't touch other teams' state)
- DynamoDB: scoped via LeadingKeys to team's state paths only
Terraform Plan🚧 Changes detected — Plan: 0 to add, 1 to change, 0 to destroy. Plan outputLLM ReviewRisk: 🟢 LOW Terraform plan adds S3 and DynamoDB permissions to the testteam CI role for Terraform state management.
|
Alexanderamiri
added a commit
that referenced
this pull request
May 9, 2026
## Summary
Team CI roles (`javabin-ci-team-{team}`) need access to the shared
Terraform state bucket and lock table. Without this, `terraform plan`
fails with `AccessDeniedException` on DynamoDB lock operations.
Access is fully team-scoped:
- **S3**: Only `apps/{team}/*` prefix — teams can't read/write other
teams' state
- **DynamoDB**: `LeadingKeys` condition restricts lock operations to the
team's own state paths
This maintains end-to-end ABAC isolation:
| Layer | Scope |
|-------|-------|
| S3 state | `apps/{team}/*` only |
| DynamoDB locks | Keys matching `*/apps/{team}/*` only |
| Resource tags | `aws:ResourceTag/team == team` |
| Resource names | Boundary enforces `{team}-*` prefix |
## Test plan
- [ ] Merge and apply
- [ ] Re-run test app CI — tf-plan should acquire lock and succeed
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
Team CI roles (
javabin-ci-team-{team}) need access to the shared Terraform state bucket and lock table. Without this,terraform planfails withAccessDeniedExceptionon DynamoDB lock operations.Access is fully team-scoped:
apps/{team}/*prefix — teams can't read/write other teams' stateLeadingKeyscondition restricts lock operations to the team's own state pathsThis maintains end-to-end ABAC isolation:
apps/{team}/*only*/apps/{team}/*onlyaws:ResourceTag/team == team{team}-*prefixTest plan