-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(s3): allow specifying a custom IAM Role for bucket replication #33978
base: main
Are you sure you want to change the base?
feat(s3): allow specifying a custom IAM Role for bucket replication #33978
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
Additional informationBehavior when
|
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33978 +/- ##
=======================================
Coverage 83.98% 83.98%
=======================================
Files 120 120
Lines 6976 6976
Branches 1178 1178
=======================================
Hits 5859 5859
Misses 1005 1005
Partials 112 112
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!! I added two minor comments.
postCliContext: { | ||
[SET_UNIQUE_REPLICATION_ROLE_NAME]: false, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't need to explicitly disable this function flag. It will be set true
implicitly.
postCliContext: { | |
[SET_UNIQUE_REPLICATION_ROLE_NAME]: false, | |
}, |
This fix should not cause any differences in the snapshot generation in this integration test, but if it does, I would appreciate it if you could run the snapshot update again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback. You're right, it doesn't seem necessary to consider this in the current test scenario. I will remove it.
replicationRole: new iam.Role(stack, 'ReplicationRole', { | ||
assumedBy: new iam.ServicePrincipal('s3.amazonaws.com'), | ||
}), | ||
replicationRules: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably correct not to specify replicationRules, right?
replicationRules: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are absolutely right. This replicationRule
did not reflect the original intent of testing the unspecified state. I have removed it in the latest commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!
Thank you @hassaku63 for this contribution, I agree with abstracting the permissions under a new method , which can be added in a follow up PR. Note: added |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This pull request has been removed from the queue for the following reason: Pull request #33978 has been dequeued. The pull request rule doesn't match anymore. The following conditions don't match anymore:
You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Issue # (if applicable)
Closes #33974
Reason for this change
Currently, the
aws-s3
module automatically creates and manages the IAM Role used for S3 replication. This limits integration flexibility, especially in environments where IAM Roles are provisioned externally or reused across stacks/accounts.This change addresses that limitation by allowing users to provide a custom IAM Role for replication.
Description of changes
replicationRole?: iam.IRole
property inBucketProps
.replicationRole
is provided, the CDK uses it instead of creating a new role.replicationRole
is specified,replicationRules
must also be defined and non-empty, since both are required by CloudFormation when configuring replication.Describe any new or updated permissions being added
No new IAM actions are introduced. When a custom role is provided, CDK does not attach any permissions automatically. Users are expected to grant the appropriate replication-related permissions manually.
Description of how you validated changes
Added unit and integ tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license