-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New check 7150 ELB deletion protection enabled @ManuelUgarte #869
Conversation
checks/check_extra7150
Outdated
CHECK_DELETION_PROTECTION_ENABLED=$($AWSCLI elbv2 describe-load-balancer-attributes $PROFILE_OPT --region $regx --load-balancer-arn $elbarn --query Attributes[*] --output text|grep -B 1 "deletion_protection.enabled" | grep true) | ||
ELBV2_NAME=$(echo $elbarn|cut -d\/ -f3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this inside the for-loop might take a lot of time, do we have a workaround to do a for-loop but with the data already obtained?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean for the data already obtained via describe-load-balancers
? The attributes do not show there unfortunately. For line 32, since there are multiple versions of ELBv2 (NLB, ALB and Gateway LB) the response/output varies depending on which one it is. The response/output is a list of attributes but the order of those varies in the response depending on the type of ELB and therefore I can't extract the boolean directly. That is why I decided to use grep there to determine the boolean expression. The line 33 is just to make it easier to read for the user instead of returning the full Arn but also because the describe-load-balancer-attributes
needs the full arn and can't use only the name of the ELB to run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, it took a second or so to show data from my 3 deployed ELBs in us-east-1. Please let me know if you have an idea of a workaround I could use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I did notice I can remove -B 1
from grep -B 1 "deletion_protection.enabled"
so I will make that update too before the next update. I didnt say it before but thank you for the feedback!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay!
Thank you for your answer! It looks good to me :)
checks/check_extra7150
Outdated
textInfo "$regx: No ELBs found" "$regx" | ||
fi | ||
done | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EOL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
This Pull request is called [extra7150] to Check if ELB has deletion protection attribute is enabled.