When should you run terraform init?
When should you run terraform init?
You should run terraform init after you start coding a new Terraform project and before you run terraform plan for the first time. This initializes the working directory containing the Terraform configuration files, downloads the necessary provider plugins and modules, and sets up the backend configuration. This ensures that the necessary dependencies are in place and Terraform can correctly execute the configuration.
C. his is the first command that should be run after writing a new Terraform configuration or cloning an existing one from version control.
C. After you start coding a new Terraform project and before you run terraform plan for the first time
Therefore, the correct answer is C. You should run terraform init after you start coding a new Terraform project and before you run terraform plan for the first time. This ensures that the necessary provider plugins and modules are downloaded and installed, and that the backend is set up correctly. Running terraform init after coding the project ensures that Terraform has the correct dependencies and can properly execute the configuration. Option A is incorrect because running terraform init after the first terraform apply can lead to errors, as not all necessary dependencies may have been installed. Option B is incorrect because running terraform init after the first terraform plan can result in missing provider plugins or modules needed to complete the plan. Option D is incorrect because terraform init is used to initialize a Terraform working directory that already exists. It cannot be used to create a new Terraform project.
After writing code and before Plan we should execute INIT to import plugins or modules..etc
After you start coding a new Terraform project and before you run Terraform plan for the first time
definitely "C"