Terraform 004 · HashiCorp · Maintain infrastructure with Terraform · Bank updated 2026-11-03
Terraform 004 practice questions: Maintain infrastructure with Terraform
5 free questions from 23 on this area · answer and explanation for each · no sign-up
These 5 questions come from the Maintain infrastructure with Terraform section of our Terraform 004 bank (23 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.
Free: 6 questions in study mode, no card. All 23 Maintain infrastructure with Terraform questions and the full Terraform 004 bank: $15 one-time.
1/5 · Maintain infrastructure with Terraform
An engineer must bring fifteen storage buckets that were created by hand under Terraform management. Rather than writing their HCL from scratch, the engineer wants Terraform to produce a first draft of the resource blocks to edit. Which approach does that?
ARun terraform import once for each bucket, passing the resource address and the bucket ID
BAdd an import block for each bucket and run terraform plan -generate-config-out=buckets.tf
CRun terraform import -generate-config-out=buckets.tf once for each bucket ID
DAdd an import block for each bucket and run terraform apply -generate-config-out=buckets.tf
Answer: B. The Import existing resources overview (Workflows > Import to state) states that the terraform import CLI command can only import resources into the state and does not generate configuration; to generate it, use the import block instead. The Generating configuration page describes the workflow: add import blocks, run terraform plan -generate-config-out with a new file path, review and edit the generated HCL, then run terraform apply to import the resources.
Source: HashiCorp Terraform Associate (004) exam objectives and Terraform documentation
2/5 · Maintain infrastructure with Terraform
A team runs terraform state pull > backup.tfstate against its remote workspace to keep a backup copy. Which description of backup.tfstate is accurate?
AA copy kept at the version that wrote it
BConverted to the current Terraform version
CA list of resource addresses, one per line
DThe stored state with sensitive values removed
Answer: B. The state pull page says the command downloads state from its current location and outputs the raw format to stdout, and that the state will always be converted to the current Terraform version before output. A list of addresses comes from state list, and the page describes no filtering of the output. Source: https://developer.hashicorp.com/terraform/cli/commands/state/pull
Source: HashiCorp Terraform Associate (004) exam objectives and Terraform documentation
3/5 · Maintain infrastructure with Terraform
A team must correct state data by hand after a configuration change left it out of step with the real infrastructure. A colleague warns that changes made outside normal plan and apply operations are risky. What should the team do when choosing to modify state manually?
ARun a plan first so that Terraform refreshes the state data itself
BRemove the affected resource blocks from the configuration
CMove the workspace state data onto a different backend beforehand
DKeep backups of the state data before making any change to it
Answer: D. Modifying state outside of normal terraform plan or terraform apply operations can cause Terraform to lose track of managed resources, leading to increased costs, reduced productivity, or compromised security. The pack advises keeping backups of your state data if you modify it manually.
Source: tf-cli-state, Workflow, p. 1
Source: HashiCorp Terraform Associate (004) exam objectives and Terraform documentation
4/5 · Maintain infrastructure with Terraform
An engineer imports one resource type from a provider without trouble, but a different type from the same provider cannot be imported. Which explanation fits the documentation?
Aimport support is implemented separately for each resource type
Bchild modules are blocked from being targets of any import
Cthe installed CLI release is too old for the provider version used
Dthe first import changed provider settings for the workspace
5/5 · Maintain infrastructure with Terraform
A mistaken hand edit damaged a team's state data, but an earlier version of it was kept elsewhere. In the documentation's list of state interactions, which category covers returning to that earlier version?
Ainspect the state contents
Brecover state from a backup
Cre-create the managed resources
Dmove resources within state
Other Terraform 004 areas
The same kind of free sample for every other section of the Terraform 004 bank:
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 →
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.