Question:
The following codesnippet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
AWSTemplateFormatVersion: '2010-09-09' Description: Some CloudFormation template Resources: MyResourceName: Type: AWS::SSM::Parameter Properties: Name: myParameterName Type: String Value: "somevalue" Tags: - Key: firstTagName Value: firstTagValue - Key: secondTagName Value: secondTagValue |
generates the following error in CloudFormation:
How should I structure the Tags property correctly?
Answer:
As shown in the examples of https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html.
The structure the Tags property varies by Resource (see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html).
For AWS::SSM::Parameter
Use key-value pairs instead of a Map:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
AWSTemplateFormatVersion: '2010-09-09' Description: Some CloudFormation template Resources: MyResourceName: Type: AWS::SSM::Parameter Properties: Name: myParameterName Type: String Value: "somevalue" Tags: firstTagName: firstTagValue secondTagName: secondTagValue |
This fixed my problem.