Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

HashiCorp Terraform-Associate-004 Exam - Topic 7 Question 19 Discussion

Posted by Izetta on Oct 31, 2026 at 09:30 AM

Which situation will return an error when you run terraform validate?

Suggested Answer: C

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.


Get Premium Terraform-Associate-004 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
0 comments · newest first

Currently there are no comments in this discussion, be the first to comment!

0/2000 characters

Save Cancel