Closed
Conversation
…rent deployments Move bucket policy management from Terraform to a dedicated script that reads the existing policy and adds/removes only its own statement (keyed by distribution ID). This prevents one deployment from overwriting or deleting statements belonging to other CloudFront distributions sharing the same S3 bucket. On delete, the workflow now removes the bucket policy statement BEFORE tofu destroy runs, while the distribution ID is still available in state.
Replace distribution-specific SourceArn condition with account-level SourceAccount condition. This makes the policy idempotent across multiple CloudFront distributions sharing the same S3 bucket, preventing one deployment from overwriting or deleting another's access.
Use -exclude=aws_s3_bucket_policy.static on destroy so the shared bucket policy is preserved when a deployment is deleted. Other distributions sharing the same bucket keep working.
jcastiarena
added a commit
that referenced
this pull request
Apr 17, 2026
Adds 3 IAM statements that were missing from the updated policy: - route53:GetChange on change/* — AWS provider polls this for DNS propagation; without it, deploy fails with AccessDenied AFTER creating the record (discovered in POC deploy #5) - route53:ListHostedZones + ListHostedZonesByName on * — these two actions don't support resource-level permissions; Resource must be * (the only unavoidable wildcard in the policy) - acm:GetCertificate on arn:aws:acm:us-east-1:YOUR_ACCOUNT_ID:certificate/* — provider calls both GetCertificate and DescribeCertificate; scoped to us-east-1 (CloudFront requirement) + account Also adds a placeholder replacement table to the README IAM section: YOUR_STATE_BUCKET, YOUR_ASSETS_BUCKET, YOUR_HOSTED_ZONE_ID, YOUR_ACCOUNT_ID with sources and examples. Co-Authored-By: Claude Opus 4.6 (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.
No description provided.