Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 106


terraform validate validates that your infrastructure matches the Terraform state file.

Show Answer
Correct Answer: B

The terraform validate command checks whether the configuration files in a directory are syntactically correct and consistent. It does not interact with the Terraform state file or verify that the actual infrastructure matches the state. Its primary purpose is to ensure that the provided configuration files are error-free and logically coherent.

Discussion

11 comments
Sign in to comment
RVivekOption: B
Sep 26, 2022

Validate only checks the syntax http://man.hubwiz.com/docset/Terraform.docset/Contents/Resources/Documents/docs/commands/validate.html

Uma10Option: B
Sep 1, 2022

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. It is thus primarily useful for general verification of reusable modules, including correctness of attribute names and value types. Source: https://www.terraform.io/cli/commands/validate

BurakkoOption: B
Sep 1, 2022

False, terraform validate has nothing to do with the state file.

bora4motionOption: B
Sep 1, 2022

It's more of a syntax thing.

0ptimusOption: B
Sep 5, 2022

B because Terraform validate only checks for syntax error or so

Ni33Option: B
May 9, 2023

B is the correct answer. Terraform plan validates desired state with current state configuration.

Busi57Option: B
Jul 23, 2023

false B Validate only checks the syntax

babgadOption: B
Aug 27, 2023

False B Validate runs checks that verify whether a configuration is syntactically valid and internally consistent, regardless of any provided variables or existing state. It is thus primarily useful for general verification of reusable modules, including correctness of attribute names and value types. It is safe to run this command automatically, for example as a post-save check in a text editor or as a test step for a re-usable module in a CI system https://developer.hashicorp.com/terraform/cli/v1.1.x/commands/validate

adoubanOption: B
Dec 12, 2022

B is correct

Power123Option: B
Mar 31, 2023

False , B is correct

Busi57Option: B
Jul 23, 2023

False B