Skip to content

add prevent destruction policy and function #158

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

Merged
merged 4 commits into from
Oct 17, 2019

Conversation

rberlind
Copy link
Contributor

Added new prevent-destruction-of-blacklisted-resources.sentinel with a common function it uses which is validate_destroy_resources.sentinel. The new policy has associated test cases for Terraform 0.11 and 0.12.

Note that this policy is truly cloud-agnostic since it blacklists network resources from AWS, Azure, and GCP.


for found_resources as address, r {
if r.destroy and not r.requires_new {
print("You are trying to destroy a blacklisted resource", address, "of type", type)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This print statement follows a slightly different convention than the one in the example policy, which reads:

"You are trying to destroy a resource", address, "of blacklisted type", type

@rberlind rberlind merged commit 18dae9b into master Oct 17, 2019
@rberlind rberlind deleted the add-prevent-resource-destruction-policy branch October 17, 2019 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants