Bitzu

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

Single choice

Which two policy-as-code frameworks can HCP Terraform apply to a plan through policy sets?

  1. Sentinel and OPA
  2. Ansible and Puppet
  3. Nomad and Consul
  4. 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.

Select all that apply

At which stages can a run task be configured to run?

  1. pre_plan
  2. post_plan
  3. pre_apply
  4. pre_init
  5. 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.

True or false

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.

Download on the App StoreGet it on Google Play

More Terraform Associate 004 topics in this module