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.
Currently there are no comments in this discussion, be the first to comment!