Terraform-Associate-004 practice question 7 of 35

terraform validate uses provider APIs to verify your infrastructure settings.

Full set: 360 questions
Answer options
A: True
B: False
Correct Answer:
FALSE
Explanation

The terraform validate command is a static, local operation that checks the syntax and internal consistency of Terraform configuration files. It verifies that the code is syntactically correct and consistent with the schemas of the providers and modules defined in the configuration. It does not make any network calls to provider APIs to verify resource settings or credentials. This command is designed to be a quick, offline check before committing code or running a plan.

Why Incorrect

The statement is false because it incorrectly describes the function of terraform validate. The command that interacts with provider APIs to check the validity of settings against the remote infrastructure is terraform plan. During the plan phase, Terraform refreshes the state and communicates with the provider APIs to determine what changes are needed, which implicitly validates many settings against the target platform. terraform validate strictly operates on the local files and downloaded provider schemas.

References

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 verify whether a configuration is syntactically valid and internally consistent, regardless of any provided variables or existing state."

2. HashiCorp Terraform Documentation, "Core Terraform Workflow - Validate Configuration": "Validate checks your configuration for syntax errors and internal consistency. It does not access any remote services, such as provider APIs or state. This means validate cannot check that your provider credentials are correct, or that the arguments for a specific resource are valid for your infrastructure."

3. HashiCorp Learn, "Validate Terraform Configuration": "The terraform validate command checks your configuration for syntax errors and internal consistency. Validation requires an initialized working directory with the necessary providers, but does not connect to the providers to check your configuration. This lets you run validation without providing credentials for your providers."

Scroll to Top