简体   繁体   English

如何将 JSON 类型传入 yaml cloudformation 模板

[英]How to pass in JSON type into yaml cloudformation template

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot1click-placement.html#cfn-iot1click-placement-associateddevices https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot1click-placement.html#cfn-iot1click-placement-associateddevices

states that the property AssociatedDevices is a type JSON, but when I am writing the template in YAML指出属性 AssociatedDevices 是 JSON 类型,但是当我在 YAML 中编写模板时

I have read a few responses here and have tried the following:我在这里阅读了一些回复,并尝试了以下方法:

AssociatedDevices: "--arguments": '{"SecuityButtonTemplate": !Ref TestITPA.DeviceId}'   
PlacementName: "TestITPAPlacement"      
Attributes:  "--arguments": '{"--Location": TestITPALoc}'

(this fails to build) (这无法构建)

and this:和这个:

  AssociatedDevices: '{"SecuityButtonTemplate": !Ref TestITPA.DeviceId}'   
  PlacementName: "TestITPAPlacement"
  Attributes:  '{"Location":"TestingLoc"}'

(this also fails to build) (这也无法构建)

I have even search github for YAML code referencing AssociatedDevices but not finding how people are actually doing this - can anyone help me shed some light ?我什至在 github 上搜索了引用 AssociatedDevices 的 YAML 代码,但没有找到人们实际上是如何做到这一点的 - 谁能帮我解释一下?

I lastly have tried this:我最后试过这个:

     AssociatedDevices: !Sub |
{
    SecuityButtonTemplate: !Ref TestITPA.DeviceId
}   
  PlacementName: "TestITPAPlacement"
  Attributes:  !Sub |
{
    Location: "testingLoc"
}

(this throws what seems to be an IDE erorr - the middle variable of palcementName is not longer red like the others) (这会抛出似乎是 IDE 错误的内容 - palcementName 的中间变量不再像其他变量一样是红色的)

You can try the following:您可以尝试以下操作:

AssociatedDevices: !Sub '{"SecuityButtonTemplate": "${TestITPA.DeviceId}"}'  
PlacementName: "TestITPAPlacement"
Attributes: '{"Location":"TestingLoc"}'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 aws cloudformation yaml 模板中格式化数据类型 json 的参数? - How to format parameter of data type json in a aws cloudformation yaml template? 如何在 CloudFormation yaml 模板中引用现有资源? - How to reference existing resources in CloudFormation yaml template? AWS Cloudformation-如何在 json/yaml 模板中处理字符串大写或小写 - AWS Cloudformation- How to do string Uppercase or lowercase in json/yaml template 以 Json 类型作为 cloudformation 模板的参数 - Taking Json type as parameter for cloudformation template 如何调试cloudformation模板? 策略中的语法错误。 YAML文件 - How to debug cloudformation template? Syntax errors in policy. YAML file 如何在 YAML CloudFormation 模板中的特定 VPC 中启动 Amazon EC2 - How to launch an Amazon EC2 in a particular VPC in YAML CloudFormation template 如何将对现有 VPC 的引用传递给 cloudformation 模板? - how to pass reference to existing VPC to a cloudformation template? Cloudformation 转换无效的 Yaml/JSON - Cloudformation Transform invalid Yaml/JSON 如何传递 CloudFormation JSON 中的参考列表? - How to pass list of Refs in CloudFormation JSON? 将 Azure 管道变量作为参数传递给 AWS Cloudformation 模板,类型为:数字 - Pass Azure pipeline variable to AWS Cloudformation template as parameter with type: Number
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM