fix: only reference ASGBucket when needed in user data
Closes #50 (closed)
Why
When supplying a existing S3 bucket name the deployment failed with:
custom_message: AmazonCloudFormationException Template format error: Unresolved resource dependencies [ASGBucket] in the Resources block of the template (Service: AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request ID: dd1223bd-4917-4c70-9978-2cd9ee3ef2d8; Proxy: null),
This is because the ASGBucket
was referenced inside the UserData
script without checking beforehand whether it should be created or not.
What
I used the variable mapping feature of Fn::Sub
to only reference the ASGBucket
when it is really created
Edited by Matthias Pichler