Terraform Associate (004) · Free practice question 10 of 12
Provisioners as a last resort
An engineer at Gorsedd Media plans to use a remote-exec provisioner on every virtual machine to install packages after creation. What is HashiCorp's guidance?
- A.Provisioners are the recommended way to configure every resource
- B.Provisioners are a last resort; prefer options such as provider-supported user data, cloud-init or prebuilt machine images
- C.Provisioners run before the resource is created
- D.Provisioners are tracked in state so Terraform reruns them when the script changes
Show answer and explanation
Correct answer: B. Provisioners are a last resort; prefer options such as provider-supported user data, cloud-init or prebuilt machine images
Why: HashiCorp describes provisioners as a last resort, because Terraform cannot model their actions in a plan; built-in mechanisms such as user data, cloud-init or images built with tools like Packer are preferred. Creation-time provisioners run after the resource is created. Terraform does not rerun them when a script changes unless the resource is replaced.
More free Terraform Associate (004) questions
- Skipping refresh during plan
- Local state backup file
- Default CLI workspace cannot be deleted
- Local execution mode in HCP Terraform
- Self-hosted agents for private networks
- Run triggers between workspaces
- Health assessments for drift detection
- Dynamic provider credentials with OIDC
- terraform_data triggers_replace argument
- Running tests with terraform test
- Lock file hashes for multiple platforms