Move permission boundary to terraform/org/ (human-applied)#82
Merged
Conversation
The boundary's self-protection (DenyBoundaryTampering) prevents the CI
pipeline from modifying it. Move the resource to terraform/org/ which
is human-applied with admin credentials.
Migration steps (must be done manually with --profile javabin):
Step 1: Import boundary into org state
cd terraform/org
terraform import aws_iam_policy.developer_boundary \
arn:aws:iam::553637109631:policy/javabin-developer-boundary
Step 2: Apply org to verify no changes
terraform plan # should show no changes
terraform apply
Step 3: Remove boundary from platform state
cd terraform/platform
terraform state rm module.iam.aws_iam_policy.developer_boundary
Step 4: Replace resource with data source in platform/iam/boundary.tf
(separate PR after state migration)
The platform/iam/boundary.tf resource is kept temporarily to prevent CI
from destroying it. It will be replaced with a data source in step 4.
Terraform Plan🚧 Changes detected — Plan: 0 to add, 1 to change, 0 to destroy. Plan outputLLM ReviewRisk: 🟢 LOW Adding security group modification restrictions to the developer boundary policy to prevent unauthorized changes to platform security groups.
|
Alexanderamiri
added a commit
that referenced
this pull request
Mar 17, 2026
The boundary resource was moved to terraform/org/ in #82 and the state migration is complete (import to org state + state rm from platform). Replace the resource with a data source so CI reads the existing policy instead of trying to recreate it.
3 tasks
Alexanderamiri
added a commit
that referenced
this pull request
Mar 17, 2026
## Summary Completes the boundary migration from #82. The state migration has been done manually: 1. Imported boundary into `terraform/org/` state 2. Removed from `terraform/platform/` state via `terraform state rm` This PR replaces the resource with a `data.aws_iam_policy` data source so platform CI reads the existing boundary policy instead of trying to recreate it. All references updated: `aws_iam_policy.developer_boundary.arn` → `data.aws_iam_policy.developer_boundary.arn` ## Test plan - [ ] CI plan shows 1 resource removed (the boundary) and data source read — no destroy - [ ] All roles still reference the boundary ARN correctly - [ ] Future boundary changes go through `terraform/org/` (human-applied)
Alexanderamiri
added a commit
that referenced
this pull request
May 9, 2026
## Summary The permission boundary's self-protection (`DenyBoundaryTampering`) prevents the CI pipeline from modifying it — the `ci-infra` role carries the boundary and is blocked from `iam:CreatePolicyVersion` on the boundary policy itself. This PR adds the boundary resource to `terraform/org/` (human-applied with admin credentials) and marks the `platform/iam/boundary.tf` copy for removal after state migration. ## Migration steps (manual, with `--profile javabin`) **Step 1**: Merge this PR (CI plan will show no infra changes since the platform copy is unchanged) **Step 2**: Import into org state ```bash cd terraform/org terraform init terraform import aws_iam_policy.developer_boundary \ arn:aws:iam::553637109631:policy/javabin-developer-boundary terraform plan # verify no changes ``` **Step 3**: Remove from platform state ```bash cd terraform/platform terraform state rm module.iam.aws_iam_policy.developer_boundary ``` **Step 4**: Separate PR to replace `platform/iam/boundary.tf` resource with data source ## Why not remove the platform copy now? If we remove it before the state migration, CI will plan a **destroy** of the boundary policy, which would break all IAM roles in the account. The platform copy is kept as a safety net until the state move is complete. ## Test plan - [ ] CI plan shows no changes (platform boundary unchanged) - [ ] Manual: import into org state succeeds - [ ] Manual: org plan shows no changes after import - [ ] Manual: state rm from platform succeeds - [ ] Follow-up PR: replace with data source
Alexanderamiri
added a commit
that referenced
this pull request
May 9, 2026
## Summary Completes the boundary migration from #82. The state migration has been done manually: 1. Imported boundary into `terraform/org/` state 2. Removed from `terraform/platform/` state via `terraform state rm` This PR replaces the resource with a `data.aws_iam_policy` data source so platform CI reads the existing boundary policy instead of trying to recreate it. All references updated: `aws_iam_policy.developer_boundary.arn` → `data.aws_iam_policy.developer_boundary.arn` ## Test plan - [ ] CI plan shows 1 resource removed (the boundary) and data source read — no destroy - [ ] All roles still reference the boundary ARN correctly - [ ] Future boundary changes go through `terraform/org/` (human-applied)
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
The permission boundary's self-protection (
DenyBoundaryTampering) prevents the CI pipeline from modifying it — theci-infrarole carries the boundary and is blocked fromiam:CreatePolicyVersionon the boundary policy itself.This PR adds the boundary resource to
terraform/org/(human-applied with admin credentials) and marks theplatform/iam/boundary.tfcopy for removal after state migration.Migration steps (manual, with
--profile javabin)Step 1: Merge this PR (CI plan will show no infra changes since the platform copy is unchanged)
Step 2: Import into org state
Step 3: Remove from platform state
cd terraform/platform terraform state rm module.iam.aws_iam_policy.developer_boundaryStep 4: Separate PR to replace
platform/iam/boundary.tfresource with data sourceWhy not remove the platform copy now?
If we remove it before the state migration, CI will plan a destroy of the boundary policy, which would break all IAM roles in the account. The platform copy is kept as a safety net until the state move is complete.
Test plan