* '''Policy Language''': A domain-specific language (DSL) designed to write policies. * '''Sentinel CLI''': A command-line interface for testing and managing Sentinel policies. * '''Integrations''': Built-in support for HashiCorp products to apply policies during runtime. * '''Mock Data and Test Cases''': Tools to simulate and validate policy behavior before deployment.
* '''Policy Enforcement''': Ensures that infrastructure and applications adhere to defined policies. * '''Extensibility''': Custom policies can be written to cover a wide range of use cases. * '''Integration with HashiCorp Tools''': Seamlessly integrates with Terraform, Vault, Consul, and Nomad. * '''Version Control''': Policies can be versioned and managed like code. * '''Logical Expressions and Conditionals''': Supports complex policy logic using conditionals and expressions.
```hcl import "tfplan/v2" as tfplan
# Ensure that all S3 buckets have versioning enabled main = rule { all tfplan.resources.aws_s3_bucket as _, bucket { bucket.config.versioning.enabled is true } } ```
```bash sentinel test my-policy.sentinel ```
* Define a policy set in Terraform Cloud or Enterprise. * Add policies to the policy set to enforce during Terraform runs.
```hcl test "S3 bucket versioning" { description = "Test to ensure S3 buckets have versioning enabled" mock = { "tfplan/v2" = { "resources": { "aws_s3_bucket": { "my-bucket": { "config": { "versioning": { "enabled": true } } } } } } } result = true } ```