Home › Terraform 004 › Practice questions › Infrastructure as Code (IaC) with Terraform
Terraform 004 · HashiCorp · Infrastructure as Code (IaC) with Terraform · Bank updated 2026-11-03

Terraform 004 practice questions: Infrastructure as Code (IaC) with Terraform

5 free questions from 29 on this area · answer and explanation for each · no sign-up

These 5 questions come from the Infrastructure as Code (IaC) with Terraform section of our Terraform 004 bank (29 questions on this area, which carries 12.5% of the real exam). Every question is original, with the correct answer explained and linked to the source it is drawn from.

Try 6 free Terraform 004 questions → All Terraform 004 sample questions

Free: 6 questions in study mode, no card. All 29 Infrastructure as Code (IaC) with Terraform questions and the full Terraform 004 bank: $15 one-time.

1/5 · Infrastructure as Code (IaC) with Terraform
A pull request splits a long main.tf into network.tf and app.tf. After the split, aws_subnet.app sits in app.tf, aws_vpc.main is the last block in network.tf, and the subnet's vpc_id argument is set to aws_vpc.main.id. The configuration will next be applied to an empty account. What should the author do before that apply so that the VPC is created before the subnet?
AMove the aws_vpc.main block above the subnet block
BAdd depends_on = [aws_vpc.main] to the subnet block
CLeave both files and their block order as they stand
DRename network.tf to a name that sorts ahead of app.tf
Answer: C. The About the Terraform Language section describes the language as declarative and states that the ordering of blocks and the files they are organized into are generally not significant. Terraform only considers implicit relationships, such as the subnet's reference to aws_vpc.main.id, and explicit ones declared with depends_on when it determines the order of operations. The refactor therefore keeps the VPC-before-subnet order without any extra change. Source: HashiCorp Terraform Associate (004) exam objectives and Terraform documentation
2/5 · Infrastructure as Code (IaC) with Terraform
A merged change to the Terraform configuration broke production. The team wants the infrastructure back at its previous working version. Which approach matches Terraform's documented model?
ARoll back to the previous state version, then apply
BRun a built-in rollback subcommand on the state
CRevert the commit in version control and apply again
DRun terraform apply -refresh-only to restore the old values
Answer: C. The Terraform CLI command list has no rollback, revert, undo, or restore subcommand. The infrastructure-as-code tutorial states that changes can be managed through version control, as you would with application code, so the working version is restored from history and applied again. Sources: https://developer.hashicorp.com/terraform/tutorials/aws-get-started/infrastructure-as-code and https://developer.hashicorp.com/terraform/cli/commands Source: HashiCorp Terraform Associate (004) exam objectives and Terraform documentation
3/5 · Infrastructure as Code (IaC) with Terraform
A team already commits its Terraform configuration to a Version Control System and now wants to manage workflows across several teams with HCP Terraform. Which capability does HCP Terraform add for them?
AAutomatic rewriting of configuration files to remove outdated arguments
BAutomatic rollback of applied changes whenever a later run fails
CShared access to state and secret data under role-based access controls
DA replacement for the public Terraform Registry that hosts all community providers
Answer: C. HCP Terraform runs Terraform in a consistent, reliable environment and provides secure access to shared state and secret data, role-based access controls, and a private registry for sharing modules and providers. Source: tf-intro, https://developer.hashicorp.com/terraform/intro, Collaborate, p. 1 Source: HashiCorp Terraform Associate (004) exam objectives and Terraform documentation
4/5 · Infrastructure as Code (IaC) with Terraform
A software vendor wants prospects to try its product on their own cloud accounts and to test it at different scales. Which approach uses Terraform appropriately?
Aship a configuration that provisions a demo with adjustable inputs
Bhost a fixed demo cluster that the vendor operates for prospects
Cpublish a manual runbook describing the console steps of each cloud
Ddistribute a machine image with a fixed cluster layout baked in
Answer: A. Terraform can create, provision and bootstrap a demo on various cloud providers. End users try the software on their own infrastructure and can adjust parameters such as cluster size (Software Demos). Source: tf-intro-use-cases, Software Demos, p. 1 Source: HashiCorp Terraform Associate (004) exam objectives and Terraform documentation
5/5 · Infrastructure as Code (IaC) with Terraform · hard
The Terraform documentation says Terraform takes an immutable approach to infrastructure. Which benefit does it attribute to this approach?
Afaster provisioning from creating non-dependent resources in parallel
Bno need for a state file to track real infrastructure
Cless complexity when upgrading or modifying infrastructure
Dconfiguration that cannot be edited after the first apply
Answer: C. Under Manage any infrastructure, the documentation states that an immutable approach reduces the complexity of upgrading or modifying your services and infrastructure. Parallel creation and the state file are different features. Source: tf-intro, Manage any infrastructure, p. 1 Source: HashiCorp Terraform Associate (004) exam objectives and Terraform documentation
Try 6 more free Terraform 004 questions → See the whole Terraform 004 bank

Other Terraform 004 areas

The same kind of free sample for every other section of the Terraform 004 bank:

Terraform fundamentals38 qCore Terraform workflow33 qTerraform configuration29 qTerraform modules28 qTerraform state management44 qMaintain infrastructure with Terraform23 qHCP Terraform24 q

Practise Terraform 004 with instant feedback

6 free questions in study mode · no card · full Terraform 004 bank with area filters and the error log: $15 one-time · no dumps, no ads.

Start Terraform 004 free →
Read next
Terraform Associate 004 vs 003: What Changed and How to Prepare in 2026 HashiCorp retired Terraform Associate 003 on 8 January 2026. What 004 changed, the four new topics, what it means for 003 holders, and a 5-week plan.
ExamDeck is an independent study tool, not affiliated with, endorsed by, or sponsored by HashiCorp. Terraform 004 and related marks are trademarks of their respective owners, used for identification only. Exam facts checked against official HashiCorp materials (as of October 2026); always confirm current details with the vendor before booking.