Property validation failure: [Value of property {/Tags} does not match type {Map}] for AWS::SSM::Parameter in YAML

Viewed 2062

The following codesnippet:

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:

Property validation failure: [Value of property {/Tags} does not match type {Map}] for AWS::SSM::Parameter in CloudFormation

How should I structure the Tags property correctly?

1 Answers

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:

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.

Related