Reputation: 1070
In CloudFormation, how can I append a list? Tried:
!Join [ ",", [ !Ref ListParam, !Ref StringParam ]]
but got an error:
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.
Upvotes: 2
Views: 8593
Reputation: 302
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.
Upvotes: 0
Reputation: 269826
According to the error, the second parameter can be:
You are providing a list that includes a Function and a String. That is most probably the problem.
You could try calling it first with ListParam
to convert the list into a string, and then concatenate String Param
to the end of it.
Meta-code:
ListParam
= [a,b,c] and StringParam
= 'd'Upvotes: 1