[英]reuse a value in a sam template
I'm probably missing something very obvious, but I can't find a way of just setting a value that I want to reuse.我可能遗漏了一些非常明显的东西,但我找不到一种方法来设置我想要重用的值。 For instance - I have a sam template that creates a bunch of database tables - I want them to all have the same settings - and I want those settings to depend on whether it's production or not.
例如 - 我有一个创建一堆数据库表的 sam 模板 - 我希望它们都具有相同的设置 - 我希望这些设置取决于它是否是生产环境。
so at the moment I do所以此刻我做
Resources:
firstTable:
Type: AWS::DynamoDb::Table
...
DeletionPolicy: !If[ isProduction, Retain, Delete ]
secondTable:
Type: AWS::DynamoDb::Table
DeletionPolicy: !If[ isProduction, Retain, Delete ]
in the perfect world, I'd want to say something like "every dynamodb table defined in this template should have this list of settings:" - but I suspect that's not possible, but what I think IS possible - I want to somehow be able to say something like:在完美的世界中,我想说“这个模板中定义的每个 dynamodb 表都应该有这个设置列表:” - 但我怀疑这是不可能的,但我认为这是可能的 - 我想以某种方式能够说这样的话:
somewhere:
deletion_policy_value: !If[ isProduction, Retain, Delete ]
...
firstTable:
Type: AWS::DynamoDb::Table
...
DeletionPolicy: deletion_policy_value
but none of parameters, conditionals globals or environment variables seem to fit - ie I want to define a custom variable that exists only for the life of the template - environment variables seem to exist in the actual cloudformation script - which is NOT what I want (I think)但似乎没有任何参数、条件全局变量或环境变量适合 - 即我想定义一个仅在模板生命周期内存在的自定义变量 - 环境变量似乎存在于实际的 cloudformation 脚本中 - 这不是我想要的(我认为)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.