Terraform Associate 004 ยท HCP Terraform
Governance features in HCP Terraform
Sentinel and OPA policies, policy enforcement levels, run tasks, cost estimation, drift detection and health assessments (8b).
Key points
- Policy sets written with Sentinel or OPA check each plan.
- Sentinel enforcement levels are advisory, soft mandatory and hard mandatory.
- Run tasks call external systems before or after plan and apply.
- Health assessments (Standard and Premium) combine drift detection with continuous validation of custom conditions.
Source: https://developer.hashicorp.com/terraform/cloud-docs/policy-enforcement/manage-policy-sets
Practice questions
Which two policy-as-code frameworks can HCP Terraform apply to a plan through policy sets?
- Sentinel and OPA
- Ansible and Puppet
- Nomad and Consul
- Packer and Boundary
Show answer
Answer: A. Sentinel and OPA
Policy sets support Sentinel and Open Policy Agent (OPA). The other pairs are not the supported frameworks.
At which stages can a run task be configured to run?
- pre_plan
- post_plan
- pre_apply
- pre_init
- post_destroy_laptop
Show answer
Answer: A. pre_plan, B. post_plan, C. pre_apply
Run tasks can run at pre_plan, post_plan, pre_apply and post_apply. There is no stage before the organization exists or during init on a laptop.
A run task with mandatory enforcement can stop a run when the external system reports failure.
Show answer
Answer: True
True. Mandatory run tasks block the run on failure, whereas advisory ones only produce a warning.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
