声明属性
AssociatedDevices
是JSON类型,但是当我在YAML中编写模板时
我在这里阅读了一些回复并尝试了以下方法:
AssociatedDevices: "--arguments": '{"SecuityButtonTemplate": !Ref TestITPA.DeviceId}'
PlacementName: "TestITPAPlacement"
Attributes: "--arguments": '{"--Location": TestITPALoc}'
(构建失败)
还有这个:
AssociatedDevices: '{"SecuityButtonTemplate": !Ref TestITPA.DeviceId}'
PlacementName: "TestITPAPlacement"
Attributes: '{"Location":"TestingLoc"}'
(这也无法构建)
我什至在 github 上搜索引用 AssociatedDevices 的 YAML 代码,但没有找到人们实际上是如何做到这一点的 - 谁能帮我解释一下?
我终于尝试了这个:
AssociatedDevices: !Sub |
{
SecuityButtonTemplate: !Ref TestITPA.DeviceId
}
PlacementName: "TestITPAPlacement"
Attributes: !Sub |
{
Location: "testingLoc"
}
(这会引发 IDE 错误 - PlacementName 的中间变量不再像其他变量那样呈红色)
您可以尝试以下方法:
AssociatedDevices: !Sub '{"SecuityButtonTemplate": "${TestITPA.DeviceId}"}'
PlacementName: "TestITPAPlacement"
Attributes: '{"Location":"TestingLoc"}'