Skip to content

Conversation

@mellevanderlinde
Copy link
Contributor

@mellevanderlinde mellevanderlinde commented Jul 31, 2025

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

@github-actions github-actions bot added the repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK label Jul 31, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team July 31, 2025 19:25
@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Jul 31, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 31, 2025
Copy link
Contributor

@pahud pahud left a 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.*')]
     });
   });

@mellevanderlinde
Copy link
Contributor Author

@pahud That was indeed missing, I've added a test for existing roles and roles created by the Agent construct

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: de431d1
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@pahud
Copy link
Contributor

pahud commented Aug 5, 2025

LGTM! Thanks!

@pahud pahud added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Aug 5, 2025
@aws-cdk-automation aws-cdk-automation added pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. and removed pr/needs-maintainer-review This PR needs a review from a Core Team Member labels Aug 5, 2025
@vishaalmehrishi vishaalmehrishi self-assigned this Oct 24, 2025
@mergify
Copy link
Contributor

mergify bot commented Oct 24, 2025

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).

@vishaalmehrishi
Copy link
Contributor

@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.

@mergify mergify bot dismissed vishaalmehrishi’s stale review October 24, 2025 12:09

Pull request has been modified.

@pahud
Copy link
Contributor

pahud commented Oct 24, 2025

CI failed

@aws-cdk/aws-iotevents-actions-alpha: Killed
@aws-cdk/aws-iotevents-actions-alpha: Error: /codebuild/output/src3433504843/src/actions-runner/_work/aws-cdk/aws-cdk/node_modules/jsii/bin/jsii --silence-warnings=reserved-word --add-deprecation-warnings exited with error code 137
@aws-cdk/aws-iotevents-actions-alpha: Build failed.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@aws-cdk/aws-iotevents-actions-alpha: 
@aws-cdk/aws-iotevents-actions-alpha: @aws-cdk/aws-iotevents-actions-alpha: error Command failed with exit code 1.

Looks like some test was being killed?

@mergify mergify bot dismissed vishaalmehrishi’s stale review October 25, 2025 10:48

Pull request has been modified.

@mellevanderlinde
Copy link
Contributor Author

@pahud I couldn't replicate this failure locally, so I retriggered the CI. For some reason it's passing now

@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2025

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).

@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2025

This pull request has been removed from the queue for the following reason: pull request branch update failed.

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/codecov-collect.yml without workflows permission.

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.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

@mergify mergify bot dismissed vishaalmehrishi’s stale review October 29, 2025 12:24

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2025

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).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Oct 29, 2025
@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2025

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).

@ozelalisen
Copy link
Member

@Mergifyio refresh

@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2025

refresh

✅ Pull request refreshed

@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2025

This pull request has been removed from the queue for the following reason: pull request branch update failed.

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/codebuild-pr-build.yml without workflows permission.

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.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

@mergify mergify bot dismissed vishaalmehrishi’s stale review October 29, 2025 16:00

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2025

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).

@mergify
Copy link
Contributor

mergify bot commented Oct 30, 2025

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).

@mergify mergify bot merged commit b39ccf3 into aws:main Oct 30, 2025
19 of 20 checks passed
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug This issue is a bug. effort/medium Medium work item – several days of effort p2 repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bedrock: Access denied for operation 'AWS::Bedrock::Agent'

5 participants