fix: use canonical channel site S3 IAM actions - #46
Merged
Conversation
Contributor
OpenTofu TestOpenTofu test passed. View run output |
Contributor
OpenTofu PlanOpenTofu plan passed. View run outputOpenTofu will perform the following actions:
# aws_iam_role_policy.github_actions_channel_project_site_infrastructure will be updated in-place
~ resource "aws_iam_role_policy" "github_actions_channel_project_site_infrastructure" {
id = "github-actions-channel-project-site-infrastructure:channel-project-site-infrastructure"
name = "channel-project-site-infrastructure"
~ policy = jsonencode(
~ {
~ Statement = [
# (3 unchanged elements hidden)
{
Action = [
"s3:CreateBucket",
]
Effect = "Allow"
Resource = "*"
Sid = "CreateSiteBuckets"
},
~ {
~ Action = [
# (1 unchanged element hidden)
"s3:DeleteBucketPolicy",
- "s3:GetBucketAccelerateConfiguration",
+ "s3:GetAccelerateConfiguration",
"s3:GetBucketAcl",
- "s3:GetBucketCors",
- "s3:GetBucketEncryption",
- "s3:GetBucketLifecycleConfiguration",
+ "s3:GetBucketCORS",
"s3:GetBucketLocation",
# (4 unchanged elements hidden)
"s3:GetBucketPublicAccessBlock",
- "s3:GetBucketReplication",
"s3:GetBucketRequestPayment",
# (2 unchanged elements hidden)
"s3:GetBucketWebsite",
+ "s3:GetEncryptionConfiguration",
+ "s3:GetLifecycleConfiguration",
+ "s3:GetReplicationConfiguration",
"s3:ListBucket",
"s3:PutBucketAcl",
- "s3:PutBucketEncryption",
- "s3:PutBucketLifecycleConfiguration",
"s3:PutBucketOwnershipControls",
# (3 unchanged elements hidden)
"s3:PutBucketVersioning",
+ "s3:PutEncryptionConfiguration",
+ "s3:PutLifecycleConfiguration",
]
# (3 unchanged attributes hidden)
},
{
Action = [
"cloudfront:CreateOriginAccessControl",
"cloudfront:DeleteOriginAccessControl",
"cloudfront:GetOriginAccessControl",
"cloudfront:GetOriginAccessControlConfig",
"cloudfront:ListOriginAccessControls",
"cloudfront:UpdateOriginAccessControl",
]
Effect = "Allow"
Resource = "*"
Sid = "ManageSiteOriginAccessControl"
},
# (2 unchanged elements hidden)
]
# (1 unchanged attribute hidden)
}
)
# (1 unchanged attribute hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
OpenTofu will perform the following actions:
# aws_iam_role_policy.github_actions_channel_project_site_infrastructure will be updated in-place
~ resource "aws_iam_role_policy" "github_actions_channel_project_site_infrastructure" {
id = "github-actions-channel-project-site-infrastructure:channel-project-site-infrastructure"
name = "channel-project-site-infrastructure"
~ policy = jsonencode(
~ {
~ Statement = [
# (3 unchanged elements hidden)
{
Action = [
"s3:CreateBucket",
]
Effect = "Allow"
Resource = "*"
Sid = "CreateSiteBuckets"
},
~ {
~ Action = [
# (1 unchanged element hidden)
"s3:DeleteBucketPolicy",
- "s3:GetBucketAccelerateConfiguration",
+ "s3:GetAccelerateConfiguration",
"s3:GetBucketAcl",
- "s3:GetBucketCors",
- "s3:GetBucketEncryption",
- "s3:GetBucketLifecycleConfiguration",
+ "s3:GetBucketCORS",
"s3:GetBucketLocation",
# (4 unchanged elements hidden)
"s3:GetBucketPublicAccessBlock",
- "s3:GetBucketReplication",
"s3:GetBucketRequestPayment",
# (2 unchanged elements hidden)
"s3:GetBucketWebsite",
+ "s3:GetEncryptionConfiguration",
+ "s3:GetLifecycleConfiguration",
+ "s3:GetReplicationConfiguration",
"s3:ListBucket",
"s3:PutBucketAcl",
- "s3:PutBucketEncryption",
- "s3:PutBucketLifecycleConfiguration",
"s3:PutBucketOwnershipControls",
# (3 unchanged elements hidden)
"s3:PutBucketVersioning",
+ "s3:PutEncryptionConfiguration",
+ "s3:PutLifecycleConfiguration",
]
# (3 unchanged attributes hidden)
},
{
Action = [
"cloudfront:CreateOriginAccessControl",
"cloudfront:DeleteOriginAccessControl",
"cloudfront:GetOriginAccessControl",
"cloudfront:GetOriginAccessControlConfig",
"cloudfront:ListOriginAccessControls",
"cloudfront:UpdateOriginAccessControl",
]
Effect = "Allow"
Resource = "*"
Sid = "ManageSiteOriginAccessControl"
},
# (2 unchanged elements hidden)
]
# (1 unchanged attribute hidden)
}
)
# (1 unchanged attribute hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy. |
14 tasks
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
Replace eight API-shaped S3 action strings with their canonical IAM action names in the existing two-bucket-scoped
ManageSiteBucketsstatement.After PR #45 applied, the consumer plan reached the accelerate read and AWS rejected
s3:GetBucketAccelerateConfiguration; the required IAM action iss3:GetAccelerateConfiguration. The same API-to-IAM naming pattern affects CORS, encryption, lifecycle, and replication. This corrects the read actions and the already-required encryption/lifecycle write actions without widening bucket scope or adding capabilities.Fixes # N/A — recovery prerequisite for channel-project PR #15.
Type of change
Validation
No local OpenTofu, state, import, plan, or apply operation was run or claimed. The consumer plan evidence, current AWS provider source, and AWS API permission documentation were used to verify the API-to-IAM-action mapping.
Impact and rollout
Producer:
tfroot-awsowns the channel-project infrastructure role and inline policy. Consumer:channel-project/tofu/awsassumes that role through the reusable OpenTofu workflow.After merge and the environment-gated main apply, rerun the channel-project plan. It must complete its bucket refresh without access-denied errors and must not replace existing buckets. This change does not create/delete buckets, upload site assets, create CloudFront, issue certificates, or alter DNS.
Rollback before apply is closing/reverting this PR. If applied, reverting restores noncanonical action names and should not occur while the consumer root needs refresh/configuration access.
Safety and secrets
AI agent materially produced this change; reviewers should verify that every replacement action remains confined to the two project-owned bucket ARNs and corresponds to the existing OpenTofu resource read/update operations.