I want to conditionally create a tag for a resource, not just change the value. The tag should or should not be created based on a condition.
I looked at the docs and from what I found this should work:
Tags:
- Key: "sometag"
Value: "sdfsdfsdfsdf"
- Key: "someOtherTag"
Value: "sdfsdfsdfsdf"
# Only apply this tag if InDevEnvironment is true
- !If
- InDevEnvironment
-
- Key: "shouldNotEvenExistIfInProd"
Value: "sdfsdfsdfsdfsdfsdfdsf"
- !Ref "AWS::NoValue
I get an error: Value of property Tags must be a list of objects
Cloudformation syntax has never been very intuitive to me, do I have the hyphen wrong or something?