Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Last active March 28, 2021 03:12
Show Gist options
  • Save KyMidd/329974e7794c2ca1c04b3e2062c8076c to your computer and use it in GitHub Desktop.
Save KyMidd/329974e7794c2ca1c04b3e2062c8076c to your computer and use it in GitHub Desktop.
if [[ $line == *"will be destroyed"* ]]; then
# If destroyed resource is always unsafe, trigger approval
if [[ ${ResourceTypesAlwaysUnsafe[@]} =~ ${resource_type} ]]; then
# Mark this path unsafe, require approval
echo "This resource is planned to be deleted, and is always unsafe to destroy without approval:" $resource_path
approvalRequired="yes"
# If destroyed resource is always safe, then don't trigger approval
elif [[ ${ResourceTypesAlwaysSafe[@]} =~ ${resource_type} ]]; then
echo "This resource is planned to be deleted, but is marked safe to destroy without approval:" $resource_path
approvalRequired="no"
# If destroyed resource isn't handled already, then
else
echo "Approval required on" $resource_path
approvalRequired="yes"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment