I am using environment variables stored in a string list that I need to populate a few different properties with. I am aware that CloudFormation has a fn::split and fn::select but how would I use both of those at the same time to select a value from a string list
EDIT: My environment variable can be referenced like this, for example: variable: ${env:MY_VARIABLE}
But in this case, my variable is a string list, that is formatted like this: apples,oranges,bananas
So I need to split the variable on commas into a list, and then assign a certain index of that list to another property in my YAML file. So I know that I need to use some combination of Fn::Split
and Fn::Select
I just don’t know how to format it correctly, everything I’ve tried has given me errors.
EDIT2: The most recent errors I am getting is that my variables are not valid as they are being interpreted as strings and not as a series of functions. This is what I have currently:
serviceName: Fn::Select ['0', Fn::Split [",", ${env:${env:ENVIRONMENT}_SERVERLESS_PARAMS}]]
In this case I am trying to select the first value in the list.