【发布时间】:2020-01-04 00:13:53
【问题描述】:
我正在尝试编写一个 SAM 模板来拥有一个触发 Lambda 函数的 IoT 规则。出于计费原因,我正在使用的帐户需要使用一长串标识符标记所有资源。这些总是相同的,为每个资源重复复制它们似乎是一种耻辱。 SAM 允许在一种资源类型之间共享全局变量(因此每个函数都可以共享标签),但我没有看到在资源类型之间应用全局标签的好方法。
我考虑过使用参数并尝试引用它,但没有支持的参数类型允许标签的键/值结构。 https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
我很想做这样的事情:
Parameters:
UniversalTags:
Type: KeyValueObject
Default:
-
Key: "Name"
Value: "my name"
-
Key: "Manager"
Value: "my manager"
-
Key: "Market"
Value: "my market"
-
Key: "Engagement Office"
Value: "location"
-
Key: "Email"
Value: "email@test.com"
Resources:
IoTProcessingFunction:
Type: AWS::Serverless::Function
Properties:
Tags: !Ref UniversalTags
IoTRule:
Type: AWS::IoT::TopicRule
Properties:
Tags: !Ref UniversalTags
有谁知道实现这个的方法吗?
【问题讨论】:
标签: yaml amazon-cloudformation aws-sam