This is something that comes down mainly to my misunderstanding of how this would work but I’m guessing I will not be the only one out there, thus the simple explanation below.
In an AWS Cloudformation script where I’m including a number of tags with my resources. I started with the following;
- Parameters in this format. Note the “Default” value is a string representing a keypair value.
“AppTag”: {
“Default”: “app:myapplication”,
“Description” : “Application tag keypair”,
“Type”: “String”},
- “Tags” property on my resource like this.
“Tags” : {“Fn::Join” : [“,”,[ { “Ref” : “AppTag” }, { “Ref” : “DeptTag” }, { “Ref” : “EnvTag” }, { “Ref” : “InstanceNameTag” }]]}
When I run a Cloudformation script using the above I get an error “….property Tags must be of type list….”. For many of you it may seem obvious that my issue is that although my value for the “AppTag” (etc) parameter looks like a keypair it is actually a string.
Thus how I should be doing this is;
- My parameters in this format.
“AppTagValue”: {
“Default”: “myapplication”,
“Description” : “Application tag value”,
“Type”: “String”},
- And my “Tags” property on my resource like this.
“Tags” : [
{“Key” : “App”, “Value” : { “Ref” : “AppTagValue” }},
{“Key” : “Dept”, “Value” : { “Ref” : “DeptTagValue” }},
{“Key” : “Env”, “Value” : { “Ref” : “EnvTagValue” }},
{“Key” : “Name”, “Value” : { “Ref” : “InstanceNameTagValue” }}
]