I am writing a shell script for replacing a keyword in a json file with a dynamic value using shell.
123.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::xxxxxx:role/role1",
"arn:aws:iam::yyyyyy:role/role2"
]
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
I am getting the values of role1 and role2 as the terraform variables in shell script
shell.sh file has
echo $role1
echo $role2
$ cat 123.json | sed -n '/role1/ s/role1/$role/ p'
$ cat 123.json | sed -n '/role1/ s/role1/$role/ p'
But the role1 and role2 are not getting updated. Can someone help me out.
role1,role2orrole?