Skip to content

Commit

Permalink
Update the generate_config_for_cross_account_roles.sh script to sort …
Browse files Browse the repository at this point in the history
…the account names and convert them to lower case in credential and aws.spc file (#23)
  • Loading branch information
misraved authored Jan 31, 2024
1 parent 9943730 commit 61f7cb8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ while read line ; do
# extract the values we need
# print from first to NF-1 (except last two fields) replacing middle spaces by _
ACCOUNT_NAME=`echo $line | awk '{for (i=1; i<NF-1; i++) printf $i " "}' | sed 's/ $//' | sed 's/ /_/g'`
ACCOUNT_NAME=`echo $line | awk '{for (i=1; i<NF-1; i++) printf $i " "}' | sed 's/ $//' | sed 's/ /_/g' | tr '[:upper:]' '[:lower:]'`
ACCOUNT_ID=`echo $line | awk '{print $(NF - 1)}'`
# Steampipe doesn't like dashes, so we need to swap for underscores
Expand Down Expand Up @@ -149,7 +149,7 @@ connection "aws_${SP_NAME}" {
EOF
done < <(aws organizations list-accounts --query "Accounts[?Status!='SUSPENDED'].[Name,Id,Status]" --output text --profile $SOURCE_PROFILE)
done < <(aws organizations list-accounts --query "Accounts[?Status!='SUSPENDED'].[Name,Id,Status]" --output text --profile $SOURCE_PROFILE | sort -f)
if [ $COMMAND == "LOCAL" ] ; then
echo "Now append $AWS_CONFIG_FILE to your active config file where $SOURCE_PROFILE is defined"
Expand Down

0 comments on commit 61f7cb8

Please sign in to comment.