Model error: Each Fn::Join object requires two parameters, (1) a string delimiter and (2) a list of strings to join or a function that returns a list of strings (such as Fn::GetAZ) to join . | by Teri Radichel | Biting Bugs | November 2023

esteria.white

I seem to make this mistake a lot because AWS CloudShell “fixes” the indentation of my model.

I’ve already had this error too many times today, so I’m documenting it in case anyone else is stuck on it. I happen to be working on initial admin scripts for a new AWS account in my latest series. Normally I don’t recommend CloudShell, but it’s the easiest way to deploy the initial user and required policies.

So I’m using CloudShell and I have some Join statements. And every time I copy and paste something, CloudShell doesn’t handle it at all, as I already wrote. I hope this will be fixed when AWS releases Amazon Linux 2023 in CloudShell.

Also, when I copy and paste lines of code or move them, CloudShell blows up my code and sometimes I don’t notice it.

Here’s what I end up with:

which leads to this error:

Model error: Each Fn::Join object requires two parameters, (1) a string delimiter and (2) a list of strings to join or a function that returns a list of strings (such as Fn::GetAZ) to join .

Do you see the problem? Look at the last line above.

It should be indented like this:

Join requires a list of two items. In YAML, a list is represented as this list of fruits.

- apple
- orange
- banana
- dragonfruit

Join needs a list with the delimiter and the elements to concatenate:

!Join
- (your delimter like an empty string, a comma, a space, or a tab)
- (your list goes hehre)

So if I want a comma delimited list of fruits, it would look like this:

!Join
- ','
- - apple #<<< two dashes here
- orange #<<< indented
- banana #<<< indented
- dragonfruit #<<< indented
Leave a comment