-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-backup: Attribute BackupVault.props.backupVaultName fails a validation when used with parameters #21735
Comments
Workaround: const stage = new CfnParameter(this, 'Stage', { type: 'String', description: 'Stage' });
new backup.BackupVault(this, 'BackupVault', {
backupVaultName: `WILL-REPLACE-BELOW`
});
const cfnBackupVault = backupVault.node.findChild('Resource') as backup.CfnBackupVault;
cfnBackupVault.backupVaultName = `backupVault-${stage.valueAsString}`; |
Whoops the validation needs to check if there is a token inside before running the regex. Something like if: if (props.backupVaultName && !Token.isUnresolved(props.backupVaultName) && ...) {
validate
} |
Hi @kaizencc , I want to fix this issue, could you assign to me? |
…lidation when used with parameters aws#21735
Previous PR was automatically closed, so I newly submitted PR. |
…rred in the name (#25943) Validation for Backup vault name fails when parameters are referred in the name now. Current implementation simply validates vault name with regular expression described in [CFn reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-backup-backupvault.html#cfn-backup-backupvault-backupvaultname), so it does not consider the special characters for parameters. This PR solves the issue by checking props.backupVaultName is resolved. Closes #21735 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Describe the bug
Trying to put a CF-parameter into the name of backup vault fails.
Expected Behavior
should run (allow the usage of tokens/parameters)
Current Behavior
fails with:
Reproduction Steps
Run:
Possible Solution
Remove the regEx validation from https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-backup/lib/vault.ts:264
I think the validation is misplaced here, because it should support expressions like
bla-${Token[TOKEN.285]}-bla
.Additional Information/Context
No response
CDK CLI Version
2.38.1 (build a5ced21)
Framework Version
2.38.1
Node.js Version
v16.15.1
OS
Windows 10
Language
Typescript
Language Version
4.7.4
Other information
No response
The text was updated successfully, but these errors were encountered: