hashicorp / hashicorp/sentinel-sdk

Better instructions for Sentinel with terraform.

Open
#71 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
58
Forks
10
PR merge metrics
No merged PRs in 30d

Description

## Add these notes in website to help new sentinel beginners
#### Its like "a quickstart guide to use sentinel with terraform"
---

Example (sentinel.hcl) file for terraform:
```
sentinel {
features = {
apply-all = true
terraform = true
}
}

import "plugin" "tfplan/v2" {
config = {
"plan_path": "./tfplan.json"
}
}
```
Example rule for terraform version parser:
```
import "tfplan/v2" as tfplan
import "strings"

v = strings.split(tfplan.terraform_version, ".")

version_major = int(v[0])
version_minor = int(v[1])

print(version_major,version_minor)
```
**Notes**:
- In root folder you should have a file named `sentinel.hcl`. This is used for settings (e.g import plugins like 'tfplan' ).
- tfplan shall have exact path of plan file in config.

---

**Quick steps to run with terraform**
1. `terraform plan -out=tfplan` --> export of plan file
2. `terraform show -json tfplan > tfplan.json` --> export plan in json
3. edit `sentinel.hcl` `plan_path` to match `./tfplan.json` (exact path)
4. finally run sentinel to test configuration with `sentinel apply -trace -config `
---

### Hope these instructions will be imported in website of documentation to help newcomers
### Your instructions are not clear in many places.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the website documentation and any existing Sentinel or Terraform guides. Add a quickstart covering the sentinel.hcl example, Terraform plan-to-JSON steps, plan_path configuration, and the sentinel apply command. Done means a newcomer can follow the guide to test a Terraform configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
terraform
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.