HashiCorp Terraform-Associate-004 Practice Exam Questions & Answers
HashiCorp Terraform-Associate-004 Exam Details
Key details for this exam, checked against the published exam outline
- Exam Code
- Terraform-Associate-004
- Full Name
- HashiCorp Certified: Terraform Associate (004)
- Issuing Body
- HashiCorp
- Question Format (Our Bank)
- Multiple Choice
- Delivery
- Online proctored
- Eligibility
- No prerequisites required
- Validity
- 12 months
- Full Question Set
- 373 questions Get All Questions
Free Terraform-Associate-004 Practice Questions
Each question shows the correct answer and an explanation of why it is right
Question 1 Domain 6 Terraform state management
Which of the following does terraform apply change after you approve the execution plan? (Choose two.)
Theterraform applycommand changes both the cloud infrastructure and the state file after you approve the execution plan. The command creates, updates, or destroys the infrastructure resources to match theconfiguration. It also updates the state file to reflect the new state of the infrastructure. The.terraformdirectory, the execution plan, and the Terraform code are not changed by theterraform applycommand.Reference=Command: applyandPurpose of Terraform State
Question 2 Domain 7 Maintain infrastructure with Terraform
You have used Terraform lo create an ephemeral development environment in the (loud and are now ready to destroy all the Infrastructure described by your Terraform configuration To be safe, you would like to first see all the infrastructure that Terraform will delete.
Which command should you use to show all of the resources that mil be deleted? Choose two correct answers.
To see all the resources that Terraform will delete, you can use either of these two commands:
terraform destroywill show the plan of destruction and ask for your confirmation before proceeding. You can cancel the command if you do not want to destroy the resources.
terraform plan -destroywill show the plan of destruction without asking for confirmation. You can use this command to review the changes before runningterraform destroy.Reference= : Destroy Infrastructure : Plan Command: Options
Question 3 Domain 4 Terraform configuration
Which of the following module source paths does not specify a remote module?
The module source path that does not specify a remote module issource = 'module/consul'. This specifies a local module, which is a module that is stored in a subdirectory of the current working directory. The other options are all examples of remote modules, which are modules that are stored outside of the current working directory and can be accessed by various protocols, such as Git, HTTP, or the Terraform Registry. Remote modules are useful for sharing and reusing code across different configurations and environments.Reference= [Module Sources], [Local Paths], [Terraform Registry], [Generic Git Repository], [GitHub]
Get the complete Terraform-Associate-004 question set
$20$40
Question 4 Domain 2 Terraform fundamentals
Terraform variable names are saved in the state file.
Terraform variable names are not saved in the state file, only their values are. The state file only stores the attributes of the resources and data sources that are managed by Terraform, not the variables that are used to configure them.
Question 5 Domain 6 Terraform state management
How does the Terraform cloud integration differ from other state backends such as S3, Consul,etc?
This is how the Terraform Cloud integration differs from other state backends such as S3, Consul, etc., as it allows you to perform remote operations on Terraform Cloud's servers instead of your local machine. The other options are either incorrect or irrelevant.
Question 6 Domain 7 Maintain infrastructure with Terraform
The -refresh-only parameter will update your state file when used with terraform plan.
Rationale for Correct Answer: terraform plan -refresh-only refreshes (reconciles) the state with
the real infrastructure only for the purpose of the plan output. It does not persist (write) those updates to the state file. To actually update the stored state, you must run terraform apply -refresh-only (or a normal terraform apply). This matches the Terraform CLI objective: plan previews changes; apply makes changes (including writing state).
Analysis of Incorrect Options (Distractors):
A (True): Incorrect because terraform plan does not write state; it only calculates and displays what would change.
Key Concept: The plan vs apply workflow and when Terraform writes state.
Question 7 Domain 5 Terraform modules
Which situation will return an error when you run terraform validate?
Detailed
Rationale for Correct Answe r:terraform validate checks whether the configuration is syntactically valid and internally consistent (for example: references resolve correctly, required arguments exist, blocks are in the correct structure). If your configuration references an input variable like var.instance_type but you did not declare it with a variable 'instance_type' { ... } block, validation fails with an error such as ''Reference to undeclared input variable.'' This is exactly the kind of static configuration issue terraform validate is designed to catch.
Analysis of Incorrect Options (Distractors):
A: Incorrect. State drift (state not matching real infrastructure) is not detected by terraform validate. Drift is typically revealed by terraform plan/terraform refresh (or plan in general), because that requires reading state and querying providers.
B: Incorrect. Terraform's configuration language (HCL) allows tabs; indentation style is not a validation error (formatting is handled by terraform fmt, not validate).
D: Incorrect because C can definitely produce a validation error when a variable is referenced but not declared.
Key Concept:What terraform validate does: static validation of configuration syntax and internal consistency, not runtime/provider/state drift checks.
What the HashiCorp Terraform-Associate-004 Exam Covers
Exam domains verified against the Official HashiCorp Terraform-Associate-004 exam guide, last checked October 2026.
Domain 1 Infrastructure as Code (IaC) with Terraform
Understand what IaC is and the advantages of infrastructure-as-code patterns. Learn how Terraform manages multi-cloud, hybrid cloud, and service-agnostic workflows to enable consistent infrastructure provisioning across different platforms.
Domain 2 Terraform fundamentals
Install and version Terraform providers and understand how Terraform uses them to interact with infrastructure platforms. Write configurations using multiple providers and learn how Terraform manages state to track infrastructure changes.
Sample question from this domain above Q4
Domain 3 Core Terraform workflow
Master the core workflow of init, plan, apply, and destroy operations. Initialize working directories, validate configurations, review execution plans, apply changes, and clean up infrastructure while applying consistent formatting and style.
Domain 4 Terraform configuration
Use resource and data blocks effectively and refer to attributes to create cross-resource references. Define variables, outputs, and complex types. Write dynamic configurations using expressions and functions, manage dependencies, validate with custom conditions, and handle sensitive data securely including integration with Vault.
Sample question from this domain above Q3
Domain 5 Terraform modules
Understand how Terraform sources and organizes modules for code reuse. Learn about variable scope within modules, how to use modules in configurations, and strategies for managing module versions across your infrastructure codebase.
Sample question from this domain above Q7
Domain 6 Terraform state management
Understand local and remote backends for state storage. Learn about state locking mechanisms to prevent concurrent modifications and configure remote state using the backend block. Detect and manage resource drift to keep infrastructure synchronized with Terraform state.
Domain 7 Maintain infrastructure with Terraform
Import existing infrastructure into your Terraform workspace and use the CLI to inspect and understand state. Learn when and how to use verbose logging for troubleshooting and debugging Terraform operations.
Domain 8 HCP Terraform
Use HCP Terraform to create and manage infrastructure with cloud-based state management. Understand collaboration and governance features including policy enforcement. Learn how to organize work using workspaces and projects and integrate HCP Terraform with your development workflow.
Terraform-Associate-004 Exam FAQ
Common questions about the exam itself
What background do I need to pass the Terraform Associate 004 exam?
How much time do I have to answer the questions in the Terraform Associate 004 exam?
What topics are hardest for most Terraform Associate 004 candidates?
How long should I study to prepare for Terraform Associate 004?
Is the Terraform Associate 004 exam online proctored?
What happens if I fail the Terraform Associate 004 exam?
How long is the Terraform Associate 004 certification valid after I pass?
What job roles match the Terraform Associate 004 certification?
How does Terraform Associate 004 relate to the Terraform Professional exam?
What is the difference between Terraform Associate 003 and 004?
Other HashiCorp Exams
Free practice questions for more HashiCorp certification exams
