From eb2147c7159cf1ed14b1e5b6784d7d07c3662b52 Mon Sep 17 00:00:00 2001
From: Noam Cohen <noam@noam.me>
Date: Fri, 13 Jan 2023 15:35:30 +0200
Subject: [PATCH] feat(aws): load profiles from credentials file (#11196)

Fixes #8472
---
 plugins/aws/aws.plugin.zsh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index 2167f552..865e82f1 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -146,6 +146,7 @@ function aws_change_access_key() {
 }
 
 function aws_profiles() {
+  aws --no-cli-pager configure list-profiles 2> /dev/null && return
   [[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
   grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([^[:space:]]+)\][[:space:]]*$/\2/g'
 }