如何在CloudFormation中追加列表 [英] How to append a list in CloudFormation

查看:96
本文介绍了如何在CloudFormation中追加列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CloudFormation中,如何添加列表?尝试过:

In CloudFormation, how can I append a list? Tried:

!Join [ ",", [ !Ref ListParam, !Ref StringParam ]]

但出现错误:

A client error (ValidationError) occurred when calling the
ValidateTemplate operation: Template error: every Fn::Join object
requires two parameters, (1) a string delimiter and (2) a list of
strings to be joined or a function that returns a list of strings
(such as Fn::GetAZs) to be joined.

推荐答案

首先,我们需要知道您想要实现什么. 如果要将新的字符串参数附加到列表中并以一个String形式获取输出,则可以使用!Join. 因为!Join的特征是将一组值附加到单个值中. 如果您想这样做,可以尝试以下代码:

First, we need to know what do you want to achieve. If you want to append new a string parameter into a list and get the output in one String you can use !Join. Because the characteristic of !Join is to appends a set of values into a single value. If you want to do that you can try the code below:

!Join [ ",", [ !Join [ ",", [ !Ref ListParam ] ], !Ref StringParam ] ]

如果要将这些值附加到列表"类型中,则应尝试另一种方法. 如果提供示例案例,将会更加容易.

If you want to append those values into List type, you should try another way. It will be easier if you provide the example case.

这篇关于如何在CloudFormation中追加列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆