aws-ia / taskcat

Test all the CloudFormation things! (with TaskCat)
https://aws-ia.github.io/taskcat/
Apache License 2.0
1.16k stars 213 forks source link

How to pass random values for certain parameter in taskcat file #797

Open nitinitare opened 1 year ago

nitinitare commented 1 year ago

When I am creating multiple resources through AWS codepipeline, all the builds will trigger at same time and only one build succeeds and other fails with error the resource already exist. I have only one .taskcat.yml file which is in the same folder as cloudformation template. And I have multiple .json parameters file in a different folder to create multiple resource.

Is there any way to pass random values for a parameter like resourcename(can be a s3 bucket, dynamodb table, rds, iam role etc)?

Let me know if there is a workaround.

tlindsay42 commented 1 year ago

In infrastructure as code (IaC), naming is best implemented through tags/metadata rather than resource names to avoid situations like that, but there are ways to accomplish what you want, such as using taskcat pseudo parameters like $[taskcat_random-string] and/or appending either all or part of the stack ID (using CloudFormation intrinsic functions like sub, split, join, et cetera).