简体   繁体   中英

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. 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/ )

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. 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:

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.

You may be able to use !Transform to do a find-and-replace operation, but it depends on the specific circumstances that you have.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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