aws / aws/aws-cdk

aws-cdk-lib/iam: undocumented (??) change for User.addManagedPolicy in aws-cdk-lib v2.214.1

Open
#35,857 3 comments 0 reactions 0 assignees View on GitHub
aws-cdk-lib bug p2 potential-regression
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Looking at the release notes from aws-cdk-lib `v2.214.1`, there is no clear notice / breaking change that the method arguments for `User.addManagedPolicy()` have changed.

the change is https://github.com/aws/aws-cdk/commit/09fc592f8debaf0b66ad5bec57d677ab776c0d6f#diff-19005fbcd4302d9da1562c135125721bebbf78f81e7ab3c90a4490433ba6d45eR18 which now requires a `Node` being set.

The CDK documentation mentions this argument https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IManagedPolicy.html but there is no example of how to get that Node or why it is now necessary.

### Regression Issue

- [x] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

2.214.0

### Expected Behavior

- Better documentation and highlighting of interface changes
- Mark these changes as breaking changes, and provide migration guidance

### Current Behavior

Typing shows that `User.addManagedPolicy` is missing a `node: NODE` setting. This is affecting type-checks of infrastructure code.

It is **not** affecting `cdk synth`

### Reproduction Steps

In v2.214.0 the code below had no typing issues. In v2.214.1, Typescript shows an error

```ts
import { User } from "aws-cdk-lib/aws-iam";

const repositoryUser = new User(this, "DashboardRepositoryMirrorUser");
repositoryUser.addManagedPolicy({
managedPolicyArn: "arn:aws:iam::aws:policy/AWSCodeCommitPowerUser",
});
```

Image

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

2.214.1

### AWS CDK CLI version

2.1031.0 (build 3d7b09b)

### Node.js Version

v22.14.0

### OS

macOS 26.0.1 (25A362)

### Language

TypeScript

### Language Version

5.9.3

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the User.addManagedPolicy entry point and the linked commit, then compare the v2.214.0 and v2.214.1 TypeScript signatures and release notes. Done means the API documentation explains the required Node, shows how to obtain it, provides migration guidance, and clearly marks the interface change as breaking.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
api, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.