以下代码片段:
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 中生成以下错误:
我应该如何正确构建 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/