-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(bedrock-alpha): apply permission dependency to existing and non-existing roles #35123
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
Conversation
pahud
left a comment
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 the PR!
Consider to add a unit test that explicitly verifies grant.applyBefore() is called for existing roles:
test('applies dependency for existing role', () => {
const existingRole = new iam.Role(stack, 'ExistingRole', {
assumedBy: new iam.ServicePrincipal('bedrock.amazonaws.com'),
});
new Agent(stack, 'Agent', {
instruction: 'test',
foundationModel: BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V2_0,
existingRole,
});
// Verify CloudFormation template has DependsOn
const template = Template.fromStack(stack);
template.hasResource('AWS::Bedrock::Agent', {
DependsOn: [Match.stringLikeRegexp('.*DefaultPolicy.*')]
});
});|
@pahud That was indeed missing, I've added a test for existing roles and roles created by the Agent construct |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
LGTM! Thanks! |
|
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). |
|
@mellevanderlinde Thank you for the contribution - this is an important one! The change looks good; however, it looks like some conflicts need to be resolved before this can be merged. |
Pull request has been modified.
|
CI failed Looks like some test was being killed? |
Pull request has been modified.
|
@pahud I couldn't replicate this failure locally, so I retriggered the CI. For some reason it's passing now |
|
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: The pull request can't be updated
You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
Pull request has been modified.
|
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). |
|
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). |
|
@Mergifyio refresh |
✅ Pull request refreshed |
|
This pull request has been removed from the queue for the following reason: The pull request can't be updated
You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
Pull request has been modified.
|
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). |
|
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). |
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #35120
Reason for this change
Dependency on permission was only applied to new roles, not to existing roles.
Description of changes
The dependency on permission now applies to both new and existing roles.
Describe any new or updated permissions being added
Not applicable.
Description of how you validated changes
I've added an integration test for an agent with an existing/custom role attached to it.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license