HashiCorp Certified: Terraform Associate (004) Practice Questions
Prepare for TA-004 with more than an answer.
- Exam fee
- $70.5 USD
- Time limit
- 60 minutes
- Questions on the exam
- 57-60
- Passing score
- Not officially published (estimated ~70%) (scale Scaled scoring - pass/fail result)
- Level
- Associate
- Valid for
- 2 years
Domains covered on the exam 8
- Infrastructure as Code (IaC) with Terraform8%
- Terraform Fundamentals13%
- Core Terraform Workflow15%
- Terraform Configuration22%
- Terraform Modules12%
- Terraform State Management12%
- Maintain Infrastructure with Terraform8%
- HCP Terraform10%
- 1
A developer performs a
terraform applyon a large state file and the operation times out. They want to maintain the state file locally for debugging but need to update the configuration to use a remote backend for future team collaboration. Which command sequence correctly migrates the state?Show answer details
Correct answer: A
To migrate state, you define the new backend configuration and run
terraform init. Terraform detects the change and asks if you want to copy the existing state to the new backend. - 2
You are reviewing a Terraform plan output and see the following symbol next to a resource:
-/+. What does this symbol indicate will happen to the resource during the apply phase?Show answer details
Correct answer: D
The
-/+symbol signifies a replacement. This happens when an immutable attribute of a resource is changed, forcing Terraform to destroy the existing instance and create a new one. - 3
You are setting up a CI/CD pipeline for Terraform. You want to ensure that the code adheres to the canonical formatting standards before any other steps run. Which command should you use in your pipeline script to check formatting without modifying the files, returning a non-zero exit code if issues are found?
Show answer details
Correct answer: C
The
-checkflag tellsterraform fmtto check if the input is formatted. It returns a non-zero exit status if the file is not formatted correctly, which is ideal for CI pipelines to fail a build on style violations. - 4
A DevOps engineer at TechCorp is designing a disaster recovery strategy for their multi-cloud infrastructure. The infrastructure is defined using Terraform to ensure consistency across AWS and Azure environments. Which core Infrastructure as Code (IaC) benefit is primarily being leveraged when the engineer uses the same configuration files to rapidly redeploy the entire stack in a secondary region during an outage?
Show answer details
Correct answer: A
Repeatability is the specific IaC benefit that allows the exact same infrastructure to be provisioned multiple times in different environments or regions based on the same code definition. While idempotency ensures a single apply doesn't break things, repeatability is the strategic benefit for DR.
- 5
An organization is migrating a legacy manual provisioning process to Terraform. The Chief Architect asks you to explain how Terraform handles the underlying API differences between cloud providers like AWS and Google Cloud Platform (GCP) while maintaining a consistent workflow for developers. Which concept best describes this capability?
Show answer details
Correct answer: A
Terraform Core is cloud-agnostic and handles the workflow (Plan, Apply, State). It relies on specific Providers (plugins) to translate these lifecycle events into the specific API calls required by the target platform (AWS, Azure, etc.).
- 6
True or False: Terraform's declarative nature means that the order in which resources are defined in the configuration file dictates the order in which they are provisioned during the apply phase.
Show answer details
Correct answer: B
False. Terraform is declarative. The order of provisioning is determined by the dependency graph derived from implicit and explicit dependencies, not the order of the text blocks in the file.
