简体   繁体   English

Cloudformation:参数化参数的名称?

[英]Cloudformation: parameterize the name of a parameter?

I'm currently dealing with an annoying issue: 我目前正在处理一个恼人的问题:

We are storing some environment (dev/test/prod/etc) specific parameter values in SSM Parameter Store, as such they have different names. 我们在SSM参数存储中存储了一些环境(dev / test / prod / etc)特定参数值,因此它们具有不同的名称。 They change fairly often. 他们经常变化。

The environment is being passed to update-stack as a CF template parameter, and I'd like to construct the actual SSM parameter name from that (this is the blog post I'm referencing: https://aws.amazon.com/blogs/mt/integrating-aws-cloudformation-with-aws-systems-manager-parameter-store/ ) 环境作为CF模板参数传递给update-stack,我想从中构建实际的SSM参数名称(这是我引用的博客文章: https//aws.amazon.com/ blogs / mt / integrate-aws-cloudformation-with-aws-systems-manager-parameter-store /

I really want to use a single generic parameter in my Cloudformation template, however, that does not seem to be possible because the values of the parameters need to be hardcoded. 我真的想在我的Cloudformation模板中使用单个泛型参数,但是,这似乎不可能,因为参数的值需要硬编码。 And you can't seem to !Ref a !Join statement. 而你似乎无法!参考!加入声明。

Anyone out there done something similar and found a good workaround? 那里有人做了类似的事情并找到了一个好的解决方法吗?

Unfortunately, intrinsic functions (such as !Join ) can only be used in certain parts of a CloudFormation template: 遗憾的是,内部函数(例如!Join )只能用于CloudFormation模板的某些部分

You can use intrinsic functions only in specific parts of a template. 您只能在模板的特定部分使用内部函数。 Currently, you can use intrinsic functions in resource properties, outputs, metadata attributes, and update policy attributes. 目前,您可以在资源属性,输出,元数据属性和更新策略属性中使用内部函数。

This means you will probably have to use !Join in every place that you want to build the SSM parameter name. 这意味着您可能必须使用!Join您想要构建SSM参数名称的每个位置。

You may be able to use !Transform to do a find-and-replace operation, but it depends on the specific circumstances that you have. 您可以使用!Transform来执行查找和替换操作,但这取决于您具有的具体情况。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM