aws-backup: BackupPlanName is not unique, when generated (unlike the rest of the properties that are handled either by CDK or CFn)
Describe the bug
Greetings and salutations!
Source for bug: https://github.com/aws/aws-cdk/blob/8a62b589f662ead0d354ee519a04186f7f207193/packages/aws-cdk-lib/aws-backup/lib/plan.ts#L177
Unlike any other auto-gen props, this one copies the id when not supplied, causing collisions (a resource already using the name and therefore others not being created because of it).
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Library Version
No response
Expected Behavior
The generated name should be unique and in line with the service regEx.
Current Behavior
Synth works when having two stacks in the same app, both having the same backupPlan id, but fails when deploying.
Reproduction Steps
- Define a stack that declares the backup plan
- Skip the
backupPlanNamein the props provided to the constructor - Declare two instances of the same Stack type in the same App/ Account
- Observe deployment failing
Possible Solution
Use the logic available in https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/core/lib/private/unique-resource-name.ts
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.257.0
AWS CDK CLI version
2.1125.0
Node.js Version
22.23.1
OS
all
Language
TypeScript
Language Version
No response
Other information
No response
Source: aws/aws-cdk