TERRAFORM-ASSOCIATE-003 practice question 7 of 30
[Understand Terraform Basics and CLI] terraform validate confirms that your infrastructure matches the Terraform state file.
Full set: 226 questionsThe terraform validate command is used to check whether a set of configuration files are syntactically valid and internally consistent. It performs a static analysis of the .tf files in the current directory to catch syntax errors, incorrect argument types, and other code-level issues. It does not access any remote services, provider APIs, or the Terraform state file, and therefore cannot confirm if the deployed infrastructure matches the state.
The statement is false because it incorrectly describes the function of terraform validate. The command that compares the current configuration against the existing infrastructure (as recorded in the state file) to determine what changes are needed is terraform plan. A terraform plan that results in no proposed changes indicates that the deployed infrastructure matches the configuration.
1. HashiCorp Terraform Documentation, "Command: validate": "The terraform validate command validates the configuration files in a directory, referring only to the configuration and not accessing any remote services such as remote state, provider APIs, etc. Validate runs checks that require access to both the configuration and the state, and reports inconsistencies." This source explicitly states that validate does not access remote state or infrastructure.
2. HashiCorp Terraform Documentation, "The Core Terraform Workflow": In the "Write" and "Validate" step, the documentation describes terraform validate as a command to "check your configuration for syntax errors and other issues." In the subsequent "Plan" step, it describes terraform plan as the command to "preview the changes Terraform will make to match your configuration." This clearly separates the roles of the two commands.
3. HashiCorp Learn, "Validate Terraform Configuration": This tutorial states, "The terraform validate command validates the syntax of your Terraform code. It is a good practice to run this command before you run terraform plan or terraform apply to get fast feedback on any syntax errors in your configuration." This reinforces that its purpose is a pre-check on the code itself, not a comparison with live infrastructure.
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 8[Interact with Terraform Modules] All modules published on the official Terraform Module …
