Below is my taskdef.json file
{
"containerDefinitions": [
{
"name": "container_name",
"image": "",
"essential": true,
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/taskdef",
"awslogs-region": "us-east-2",
"awslogs-stream-prefix": "ecs"
}
}
}
]
}
I'm using an environment variable to append to this file
export IMAGE=########.dkr.ecr.us-west-1.amazonaws.com/container-repo:latest
I've ran the following command to input the image under containerDefinitions and the output shows it in there but it does not get appended permanently to the taskdef.json file.
jq ".containerDefinitions[].image=\"$IMAGE\"" taskdef.json
I've also tried the following command to add the output to a new file but I have multiple json data injections so this way doesn't work.
jq ".containerDefinitions[].image=\"$IMAGE\"" taskdef.json > taskdef2.json
Is there anyway to inject an input permanently into the json file using the jq command which would be equivalent to sed -i?