{
"Comment": "An example of the Amazon States Language for notification on an AWS Fargate task completion",
"StartAt": "Process",
"States": {
"Process": {
"Type": "Map",
"InputPath": "$.data",
"ItemsPath": "$",
"Parameters": {
"value.$": "$$.Map.Item.Value"
},
"Iterator": {
"StartAt": "Making",
"States": {
"Making": {
"Type": "Task",
"Resource": "arn:aws:states:::ecs:runTask.sync",
"Parameters": {
"LaunchType": "FARGATE",
"Cluster": "mycluster",
"TaskDefinition": "mytaskdefinition",
"NetworkConfiguration": {
"AwsvpcConfiguration": {
"Subnets": [
],
"SecurityGroups": [
],
"AssignPublicIp": "DISABLED"
}
},
"Overrides": {
"ContainerOverrides": [
{
"Name": "my_container",
"Command": [
"python",
"-m",
"src"
],
"Environment": [
{
"Name": "FARMER",
"Value.$": "$.value.farmer"
}
}
]
}
},
"Next": "Dumping"
},
"Dumping": {
"Type": "Task",
"Resource": "arn:aws:states:::ecs:runTask.sync",
"Parameters": {
"LaunchType": "FARGATE",
"Cluster": "mycluster",
"TaskDefinition": "mytaskdefintion",
"NetworkConfiguration": {
"AwsvpcConfiguration": {
"Subnets": [
],
"SecurityGroups": [
],
"AssignPublicIp": "DISABLED"
}
},
"Overrides": {
"ContainerOverrides": [
{
"Name": "my_container",
"Command": [
"python",
"-m",
"app"
],
"Environment": [
{
"Name": "FARMER",
"Value.$": "$.Overrides.ContainerOverrides[?(@.Name=='my_container')].Environment[0].Value"
}
]
}
]
}
},
"End": true
}
}
},
"End": true
}
}
}
Just as I'm passing the value of the current iteration to the first state and setting the environment variable: "Value.$": "$.value.farmer", I want to do the same for the next state Dumping as well. I've tried all sorts of things: including "Value.$": "$.value.farmer" and "Value.$": "$.Overrides.ContainerOverrides[?(@.Name=='my_container')].Environment[0].Value" but they either didn't work at all or didn't work to my satisfaction
"Value.$": "$.Overrides.ContainerOverrides[?(@.Name=='my_container')].Environment[0].Value" returned a json instead of a string even though the filtering seems to be correct
Input data looks like this:
{
"data": [
{"orch": "67e6", "farmer": "mast"},
{"orch": "67e61b", "farmer": "dono"},
{"orch": "65d0", "farmer": "pana"}
]
}