summaryrefslogtreecommitdiff
path: root/plugins/aws
diff options
context:
space:
mode:
authorGauthier Delacroix <1533042+gdlx@users.noreply.github.com>2024-01-30 21:36:18 +0100
committerGitHub <noreply@github.com>2024-01-30 21:36:18 +0100
commite195c7cb438224e8bcea20bdbc2e4b8a6bb3949b (patch)
tree6c64aa658635d45674ab341ee38e4804b51a73c8 /plugins/aws
parent8b2ce98578da743fbc4a208285f33744d6abd3cf (diff)
downloadzsh-e195c7cb438224e8bcea20bdbc2e4b8a6bb3949b.tar.gz
zsh-e195c7cb438224e8bcea20bdbc2e4b8a6bb3949b.tar.bz2
zsh-e195c7cb438224e8bcea20bdbc2e4b8a6bb3949b.zip
fix(aws): pass default region to fetch regions (#12175)
Co-authored-by: Gauthier Delacroix <no@email.com>
Diffstat (limited to 'plugins/aws')
-rw-r--r--plugins/aws/aws.plugin.zsh11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index fd00714e7..7a2e08a7c 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -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