TERRAFORM-ASSOCIATE-003 practice question 15 of 30
[Understand Terraform Basics and CLI] Which of these commands makes your code more human readable?
Full set: 226 questionsThe question contains a likely typo in option D; the correct command is terraform fmt. The terraform fmt command is the standard tool used to rewrite Terraform configuration files to a canonical format and style. It recursively processes files in the current directory to ensure consistent indentation, spacing, and alignment. This makes the HCL code more human-readable and maintainable for developers working on the project, without changing the behavior of the configuration.
A. Terraform validate: This command checks for syntax errors and internal consistency but does not reformat the source code files for readability.
B. Terraform output: This command extracts and displays output values from the state file; it does not modify or format the configuration code.
C. Terraform show: This command presents a plan or state file in a human-readable format but does not reformat the source .tf files.
1. HashiCorp Developer - Terraform CLI
fmt command: "The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style." This directly supports the primary function of making code readable.
Source: HashiCorp
developer.hashicorp.com/terraform/cli/commands/fmt
2. HashiCorp Developer - Terraform CLI
validate command: "The terraform validate command validates the configuration files in a directory... Validation runs a series of checks..." This confirms its purpose is validation
not formatting.
Source: HashiCorp
developer.hashicorp.com/terraform/cli/commands/validate
3. HashiCorp Developer - Terraform CLI
show command: "The terraform show command is used to provide human-readable output from a state or plan file." This clarifies that it makes the output (plan/state) readable
not the source code itself.
Source: HashiCorp
developer.hashicorp.com/terraform/cli/commands/show
4. HashiCorp Developer - Terraform CLI
output command: "The terraform output command is used to extract the value of an output variable from the state file." This confirms its role is data extraction
not code formatting.
Source: HashiCorp
developer.hashicorp.com/terraform/cli/commands/output
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 7[Understand Terraform Basics and CLI] terraform validate confirms that your infrastructur…
