summaryrefslogtreecommitdiff
path: root/plugins/aws/aws.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/aws/aws.plugin.zsh')
-rw-r--r--plugins/aws/aws.plugin.zsh8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index c18bd634b..920a7139d 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -45,6 +45,7 @@ function acp() {
fi
local profile="$1"
+ local mfa_token="$2"
# Get fallback credentials for if the aws command fails or no command is run
local aws_access_key_id="$(aws configure get aws_access_key_id --profile $profile)"
@@ -58,9 +59,10 @@ function acp() {
if [[ -n "$mfa_serial" ]]; then
local -a mfa_opt
- local mfa_token
- echo -n "Please enter your MFA token for $mfa_serial: "
- read -r mfa_token
+ if [[ -z "$mfa_token" ]]; then
+ echo -n "Please enter your MFA token for $mfa_serial: "
+ read -r mfa_token
+ fi
if [[ -z "$sess_duration" ]]; then
echo -n "Please enter the session duration in seconds (900-43200; default: 3600, which is the default maximum for a role): "
read -r sess_duration