-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Describe the bug
Creating a UserPoolGroup object allows for setting the groupName attribute. However, the resource constructor is overriding the field to the resource ref.
While the underlying CfnUserPoolGroup is correctly created in CloudFormation, it is impossible to refer to the actual, explicitly set groupName in the CDK code. This makes it impossible to e.g. filter for a group in an array of groups by name.
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Library Version
No response
Expected Behavior
The explicitly set groupName attribute not to be overridden but taken, set and kept as specified for later reference.
Current Behavior
groupName being overwritten with the cfn resource ref
Reproduction Steps
const userPoolGroups: cognito.UserPoolGroup[] = [];
for (const userPoolGroupName of ["adminA", "adminB", "user"]) {
userPoolGroups.push(
new cognito.UserPoolGroup(this, userPoolGroupName, {
userPool: this.userPool,
groupName: userPoolGroupName,
})
);
}
new cdk.CfnOutput(this, "adminUserPoolGroupNames", {
value: userPoolGroups.map((group) => group.groupName).join(", "),
});
The output will NOT have the groupNames, but the group refs as value
Possible Solution
do not set the groupName attribute to the resource ref, but the user provided groupName
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.217.0
AWS CDK CLI version
2.1023.0 (build 45ceb89)
Node.js Version
v20.19.3
OS
Mac OS
Language
TypeScript
Language Version
No response
Other information
No response