From fe9d87d6dc2f3e6194862799b0707f97844e83ac Mon Sep 17 00:00:00 2001 From: Mike Mattice Date: Wed, 19 Jan 2022 08:58:34 -0600 Subject: feat(aws): accept aws mfa tokencode on `acp` cli call (#10130) Co-authored-by: Mike Mattice --- plugins/aws/aws.plugin.zsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'plugins/aws/aws.plugin.zsh') 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 -- cgit v1.2.3-70-g09d2