Using the aws:loop has been clear as mud, especially as it relates to using an output from a previous step as input for this step.
I have a step (uses this: AWS-RunPowerSHellScript) that outputs an array (I have also tried tables too). An example of this array would be a list of filenames:
a.file, b.file, c.file
the JSON as:
"outputs": [
{
"Type": "StringList",
"Name": "Name",
"Selector": "$.Payload"
}
I need to iterate over that list in an aws:loop step, but no matter how I adjust output - I always get a "Failed to resolve Name.Output to type StringList."
the JSON as:
"name": "Loop",
"action": "aws:loop",
"nextStep": "NextStep",
"isEnd": false,
"inputs": {
"Iterators": "{{ Name.Output }}",
"IteratorDataType": "StringList",
"Steps": [ ...
Does anyone know how I can iterate over Name.Output using aws:loop? Or, how I need to adjust the data type/data in the step with output?
So, this was easier than I thought. Though aws:loop always errors with validating a StringList, it is unable (or I can't figure out) to iterate over just an array:
some_arr=[ 1, 2, 3, 3]
But, aws:loop can detect type and will iterate over a StringMap:
some_dict={"some_key": some_arr}
The JSON would look something like this for step output and aws:loop input:
"outputs": [
{
"Type": "StringList",
"Name": "outputName",
"Selector": "$.some_key"
}
]
"inputs": {
"IteratorDataType": "StringMap",
"Iterators": "{{ stepName.outputName }}"
}
Now, the above solution probably would come naturally to someone who codes day-to-day, but it would have been nice to have more documentation or documentation that gives examples of the required data structures when using this step function.