From 3ecb5dbce6061d006d5ee11684936cb2ed646484 Mon Sep 17 00:00:00 2001 From: Leonardo Azize Martins Date: Fri, 4 Feb 2022 14:05:10 -0300 Subject: [PATCH] Fix AccessDenied issue (#1025) --- checks/check_extra760 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/checks/check_extra760 b/checks/check_extra760 index 1d031603..c2aad496 100644 --- a/checks/check_extra760 +++ b/checks/check_extra760 @@ -40,7 +40,11 @@ extra760(){ for lambdafunction in $LIST_OF_FUNCTIONS;do LAMBDA_FUNCTION_FOLDER="$SECRETS_TEMP_FOLDER/extra760-$lambdafunction-$regx" LAMBDA_FUNCTION_FILE="$lambdafunction-code.zip" - LAMBDA_CODE_LOCATION=$($AWSCLI lambda get-function $PROFILE_OPT --region $regx --function-name $lambdafunction --query Code.Location --output text) + LAMBDA_CODE_LOCATION=$($AWSCLI lambda get-function $PROFILE_OPT --region $regx --function-name $lambdafunction --query Code.Location --output text 2>&1) + if [[ $(echo "$LAMBDA_CODE_LOCATION" | grep AccessDenied) ]]; then + textInfo "$regx: Access Denied trying to get Lambda functions" "$regx" "$lambdafunction" + continue + fi mkdir $LAMBDA_FUNCTION_FOLDER # DOWNLOAD the code in a zip file curl -s $LAMBDA_CODE_LOCATION -o $LAMBDA_FUNCTION_FOLDER/$LAMBDA_FUNCTION_FILE