amazon-web-services - 属性验证失败:YAML 中的 AWS::SSM::Parameter [属性值 {/Tags} 与类型 {Map} 不匹配]

标签 amazon-web-services aws-cloudformation aws-ssm

以下代码片段:

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

在 CloudFormation 中生成以下错误:

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

我应该如何正确构建 Tags 属性?

最佳答案

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html的例子所示。 Tags 属性的结构因资源而异(请参阅 https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html )。 对于 AWS::SSM::Parameter 使用键值对而不是 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

这解决了我的问题。

关于amazon-web-services - 属性验证失败:YAML 中的 AWS::SSM::Parameter [属性值 {/Tags} 与类型 {Map} 不匹配],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69718237/

相关文章:

amazon-web-services - 如何忽略亚马逊雅典娜结构顺序

json - AWS IoT JSON 错误

bash - 等到 bash 脚本中满足条件

aws-cloudformation - 如何在 CDK 中创建 NAT 网关,然后添加指向 CIDR 的私有(private)子网的路由?

amazon-web-services - 如何获取其他地区的ssm参数?

aws-cloudformation - 云形成的 secret

amazon-web-services - 如何授予 RDS 实例从 CFT 或 SAM 模板调用 lambda 的权限

amazon-web-services - AWS 机器学习数据

amazon-web-services - AWS CodePipeline 错误 : Cross-account pass role is not allowed

amazon-web-services - 如何在本地 sam 中尝试 AWS Appsync