Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 526

Edit JSON property file for use in bash script

$
0
0

I have a .sh script and a .json properties file for use with AWS CLI v2 to create a CF Stack. I have a parameters file in JSON that I need to substitute one value, but all th key/value pairs are the same and I cannot figure out how to get it to pick the right one, the variable MY_ENV in defined in the script and the line below is what I need to pass the edited JSON file into. I believe it will also take it s a full String Blob instead of file if that is easier. I was trying jq with no luck but maybe there's an even easier solution

aws cloudformation create-stack --capabilities CAPABILITY_NAMED_IAM --stack-name $lambda-$env --template-url <url> --output json --parameter $property_file <-- file I am passing in

property_file

[  {"ParameterKey":"RuleState", "ParameterValue": "DISABLED"},  {"ParameterKey":"LambdaSchedule", "ParameterValue":"rate(20 minutes)"},  {"ParameterKey":"EnvironmentParam", "ParameterValue":"$MY_ENV"}, <-- the string I need changed  {"ParameterKey":"Method", "ParameterValue":"POST"},  {"ParameterKey":"LambdaName", "ParameterValue":"TestLambda"}]

Viewing all articles
Browse latest Browse all 526

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>