TERRAFORM-ASSOCIATE-003 practice question 14 of 30
[Navigate Terraform State and Backends] What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?
Full set: 226 questionsterraform plan -refresh-only reads the current real-world infrastructure, compares it to the objects recorded in the state, and then rewrites the local/remote state file with any detected drift, even if the configuration itself proposes no changes. Because the sole purpose of –refresh-only is to synchronize state with out-of-band modifications, invoking the flag always updates the state file. No other listed command guarantees that a write to state will occur purely to record external changes.
B. terraform show –json only prints the current state or plan in JSON; it never writes to the state file.
C. terraform apply –lock=false may write state only if the plan contains changes; –lock=false merely skips state locking and does not force a refresh.
D. terraform plan target-state is not a valid Terraform CLI syntax; therefore, it cannot update state.
1. HashiCorp Terraform CLI
“plan Command –refresh-only Option
” https://developer.hashicorp.com/terraform/cli/commands/plan#refresh-only
¶2–3 (accessed 2025-09-24).
2. HashiCorp Terraform CLI
“Command: show
” https://developer.hashicorp.com/terraform/cli/commands/show
¶1 (read-only nature).
3. HashiCorp Terraform CLI
“Command: apply
” https://developer.hashicorp.com/terraform/cli/commands/apply
¶4
option –lock
note on state writes only after successful changes.
Keep practicing
Take the free TERRAFORM-ASSOCIATE-003 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other TERRAFORM-ASSOCIATE-003 practice questions
- Question 1[Understand Terraform Basics and CLI] If you update the version constraint in your Terraf…
- Question 2[Navigate Terraform State and Backends] Terraform variable names are saved in the state f…
- Question 3[Understand Terraform Basics and CLI] You modified your Terraform configuration and run T…
- Question 4[Understand Terraform Basics and CLI] You must use different Terraform commands depending…
- Question 6[Understand Terraform Basics and CLI] terraform init creates an example main.tf file in t…
- Question 7[Understand Terraform Basics and CLI] terraform validate confirms that your infrastructur…
