1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-18 02:20:09 +00:00

fix(aws): pass default region to fetch regions (#12175)

Co-authored-by: Gauthier Delacroix <no@email.com>
This commit is contained in:
Gauthier Delacroix 2024-01-30 21:36:18 +01:00 committed by GitHub
parent 8b2ce98578
commit e195c7cb43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -202,8 +202,17 @@ function aws_change_access_key() {
}
function aws_regions() {
local region
if [[ $AWS_DEFAULT_REGION ]];then
region="$AWS_DEFAULT_REGION"
elif [[ $AWS_REGION ]];then
region="$AWS_REGION"
else
region="us-west-1"
fi
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
aws ec2 describe-regions |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
aws ec2 describe-regions --region $region |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
else
echo "You must specify a AWS profile."
fi