
#DEFINE SENTINEL FULL#
The policies print out the full address of each resource instance that does violate a rule in the same format that is used in plan and apply logs, namely module.module.This means a user who violates a policy will be informed about all of their violations in a single shot without having to run multiple Sentinel CLI tests or TFC/TFE plans. The policies have been written in a way that causes all violations to be reported.This makes it easier for users to understand the sample policies and to write their own policies that copy them. A related benefit of using functions from modules is that the policies themselves do not have any for loops or if/else conditionals.This is a HUGE improvement over the second-generation common functions! Since they are defined in modules, their implementations do not need to be pasted into the policies. The policies use parameterized functions defined in four Sentinel modules.As mentioned above, they use the Terraform Sentinel v2 imports, which are more closely aligned with Terraform 0.12's data model and leverage the recently added filter expression, and make it easier to restrict policies to specific operations performed by Terraform against resources.These third-generation policies have several important characteristics: Important Characterizations of the Third Generation Policies It added the Sentinel 0.16.0 runtime which introduced the option of using HCL instead of JSON configuration files. That version was released on November 10, 2020. These policies and the common functions they use can be used as organized with the current version of Terraform Cloud (TFC) and with Terraform Enterprise (TFE) v202011-1 and higher. Using These Policies with Terraform Cloud and Terraform Enterprise To learn more about Sentinel Modules, see this blog post. To learn more about the Terraform Sentinel v2 imports, see this blog post. They also use Sentinel Modules which allow Sentinel functions and rules to be defined in one file and used by Sentinel policies in other files. These policies use the Terraform Sentinel v2 imports. These policies and the Terraform Sentinel v2 imports they use can only be used with Terraform 0.12 and above. It also contains some some common, re-usable functions.Īdditionally, it contains Policy Set configuration files so that the cloud-specific and cloud-agnostic policies can easily be added to Terraform Cloud organizations using VCS Integrations after forking this repository. This directory and its sub-directories contain third-generation Sentinel policies and associated Sentinel CLI test cases and mocks which were created in 2020 for AWS, Microsoft Azure, Google Cloud Platform (GCP), and VMware.

Example Third Generation Sentinel Policies for Terraform
