Commit ee94b63
authored
fix(agentcore): custom execution role policy for runtime lacks proper permissions (#35849)
### Issue # (if applicable)
Closes #35852 .
### Reason for this change
ECR permissions are attached even when the role is a custom role or an imported role. (https://github.com/aws/aws-cdk/blob/v2.221.0/packages/%40aws-cdk/aws-bedrock-agentcore-alpha/agentcore/runtime/runtime-artifact.ts#L65)
However, the other required permissions are only granted to a policy for an auto-generated role. (https://github.com/aws/aws-cdk/blob/v2.221.0/packages/%40aws-cdk/aws-bedrock-agentcore-alpha/agentcore/runtime/runtime.ts#L252-L259)
In constructs of other common modules, permissions are attached even when a custom role is passed.
- https://github.com/aws/aws-cdk/blob/v2.221.0/packages/aws-cdk-lib/aws-codepipeline/lib/pipeline.ts#L693
- https://github.com/aws/aws-cdk/blob/v2.221.0/packages/aws-cdk-lib/aws-lambda/lib/function.ts#L1468
- https://github.com/aws/aws-cdk/blob/v2.221.0/packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts#L1161
So this PR adds the permissions to the custom role.
FYI: If you avoid to add the permissions to the custom role, you can use `withoutPolicyUpdates()` method for Role.
### Description of changes
Add the permissions to the custom role.
### Describe any new or updated permissions being added
### Description of how you validated changes
Both unit tests and an integ test.
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*1 parent ebef303 commit ee94b63
File tree
18 files changed
+1741
-34
lines changed- packages/@aws-cdk/aws-bedrock-agentcore-alpha
- agentcore/runtime
- test/agentcore/runtime
- integ.runtime-with-custom-role.js.snapshot
- asset.f06c9f54828243752afd2df4e39ab9d2987b5ccf44e6bdc05621c18d5488f240
- integ.runtime-with-imported-role.js.snapshot
18 files changed
+1741
-34
lines changedLines changed: 14 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
259 | 263 | | |
| 264 | + | |
260 | 265 | | |
261 | 266 | | |
262 | 267 | | |
| |||
320 | 325 | | |
321 | 326 | | |
322 | 327 | | |
323 | | - | |
| 328 | + | |
324 | 329 | | |
325 | 330 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
| 331 | + | |
333 | 332 | | |
334 | 333 | | |
335 | 334 | | |
336 | 335 | | |
337 | | - | |
| 336 | + | |
338 | 337 | | |
339 | 338 | | |
340 | 339 | | |
341 | 340 | | |
342 | 341 | | |
343 | 342 | | |
344 | 343 | | |
345 | | - | |
| 344 | + | |
346 | 345 | | |
347 | 346 | | |
348 | 347 | | |
349 | 348 | | |
350 | 349 | | |
351 | 350 | | |
352 | 351 | | |
353 | | - | |
| 352 | + | |
354 | 353 | | |
355 | 354 | | |
356 | 355 | | |
357 | 356 | | |
358 | 357 | | |
359 | 358 | | |
360 | 359 | | |
361 | | - | |
| 360 | + | |
362 | 361 | | |
363 | 362 | | |
364 | 363 | | |
365 | 364 | | |
366 | 365 | | |
367 | 366 | | |
368 | 367 | | |
369 | | - | |
| 368 | + | |
370 | 369 | | |
371 | 370 | | |
372 | 371 | | |
| |||
380 | 379 | | |
381 | 380 | | |
382 | 381 | | |
383 | | - | |
| 382 | + | |
384 | 383 | | |
385 | 384 | | |
386 | 385 | | |
| |||
389 | 388 | | |
390 | 389 | | |
391 | 390 | | |
392 | | - | |
393 | 391 | | |
394 | 392 | | |
395 | 393 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments