TERRAFORM-ASSOCIATE-003 practice question 6 of 30
[Understand Terraform Basics and CLI] terraform init creates an example main.tf file in the current directory.
Full set: 226 questionsThe terraform init command is used to initialize a working directory that already contains Terraform configuration files (such as main.tf). Its primary purpose is to prepare the directory for other commands by performing three main actions: initializing the backend, downloading required provider plugins, and installing any referenced modules. The command reads existing configuration files to determine which providers and modules are needed; it does not create any example or boilerplate configuration files itself.
The statement is false because the creation of configuration files like main.tf is a prerequisite step that the user must perform before running terraform init. The command's role is to set up the environment based on pre-existing configuration, not to generate that configuration.
1. HashiCorp Terraform Documentation
"Command: init". The official documentation states
"The terraform init command initializes a working directory containing Terraform configuration files." The page details the command's actions as Backend Initialization
Child Module Installation
and Plugin Installation
none of which involve the creation of a main.tf file. The command's premise is that configuration files already exist.
Source: HashiCorp
Terraform CLI Documentation
"Command: init"
https://developer.hashicorp.com/terraform/cli/commands/init
2. HashiCorp Learn
"Get Started - Provision Infrastructure". In the official introductory tutorials
the workflow clearly separates file creation from initialization. In the "Write Configuration" step
the user is explicitly instructed to create a main.tf file. Only in the subsequent step
"Initialize the directory
" is the user directed to run terraform init. This procedural separation confirms that init does not create the file but rather acts upon it.
Source: HashiCorp Learn
Get Started with Terraform
"Provision Infrastructure"
https://developer.hashicorp.com/terraform/tutorials/aws-get-started/aws-build
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 7[Understand Terraform Basics and CLI] terraform validate confirms that your infrastructur…
- Question 8[Interact with Terraform Modules] All modules published on the official Terraform Module …
