Group: addManagedPolicy is not implemented
Describe the issue
Running the current latest version on aws-cdk-lib (2.128.0), the Group construct static method addManagedPolicy is not implemented (as can be seen here).
This is not mentioned in the documentation here and it just fails silently which is unexpected behaviour.
Proposed (temporary) solution : it should be mentioned clearly in the documentation that this method isn't implemented yet, to prevent other people banging their heads on the wall like I did 😅.
Links
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Group.html#addwbrmanagedwbrpolicypolicy https://github.com/aws/aws-cdk/blob/v2.80.0/packages/aws-cdk-lib/aws-iam/lib/group.ts#L95
Yes, thank you for the callout. We should get it fixed.
@ansnoussi Can you provide a stack example that I can reproduce the failure? After a bit investigation, addManagedPolicy is unimplemented for the abstract class GroupBase which is only extended by the Group class. In the Group class, addManagedPolicy is implemented and shouldn't cause any issue.
As @GavinZZ mentioned, addManagedPolicy is not implemented because it's in the abstract class. In the extended Group class, the function is implemented.
https://github.com/aws/aws-cdk/blob/v2.80.0/packages/aws-cdk-lib/aws-iam/lib/group.ts#L213
Close the issue for now. Feel free to re-open if you have any other questions.
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. If you wish to keep having a conversation with other community members under this issue feel free to do so.