Reputation: 250
I have a a CloudFormation template with 2 parameters. I want to set an AllowedPattern value for the 2nd parameter such that its regex is dynamically generated based on the value for the first parameter. Something like this:
CloudFormation Parameters
WebsiteDomain:
Type: String
EmailAddress:
Type: String
AllowedPattern: !Sub '.*@${WebsiteDomain}'
Allowed Input
WebsiteDomain: google.com
EmailAddress: [email protected]
Disallowed Input
WebsiteDomain: google.com
EmailAddress: [email protected]
Is there any way to accomplish this?
Upvotes: 2
Views: 590
Reputation: 3544
Cloudformation templates are not so dynamic, but you could write a script using the AWS CDK which would allow you to write logic to check this yourself and then either immediately deploy it to the AWS environment or synthesize a CloudFormation template from the defined resources in your CDK app.
Upvotes: 3
Reputation: 238199
You would have to use CloudFormation macro for pre-processing of your template, before actuall deployment. Ohterwise, you can't do what you wan't.
Upvotes: 3