Fix listing EC2 Security Groups if default output format is not JSON

This commit is contained in:
Geert Smelt
2020-06-26 11:25:16 +02:00
parent 0878511abf
commit a0c58e1cb2

View File

@@ -24,7 +24,7 @@ extra75(){
textInfo "Looking for Security Groups in all regions... " textInfo "Looking for Security Groups in all regions... "
for regx in $REGIONS; do for regx in $REGIONS; do
SECURITYGROUPS=$($AWSCLI ec2 describe-security-groups $PROFILE_OPT --region $regx --max-items $MAXITEMS | jq '.SecurityGroups|map({(.GroupId): (.GroupName)})|add') SECURITYGROUPS=$($AWSCLI ec2 describe-security-groups $PROFILE_OPT --region $regx --max-items $MAXITEMS --output json | jq '.SecurityGroups|map({(.GroupId): (.GroupName)})|add')
if [[ $SECURITYGROUPS == "null" ]]; if [[ $SECURITYGROUPS == "null" ]];
then then
continue continue