nerdexam
HashiCorp

TA-002-P · Question #37

Which task does terraform init not perform?

The correct answer is D. Validates all required variables are present. The terraform init command prepares the working directory by downloading plugins, configuring the backend, and sourcing modules, but it does not validate the presence of required input variables.

Use the Terraform CLI (terraform plan, apply, destroy, fmt, init, validate, workspace, import, taint, providers, output)

Question

Which task does terraform init not perform?

Options

  • ASources all providers present in the configuration and ensures they are downloaded and
  • BConnects to the backend
  • CSources any modules and copies the configuration locally
  • DValidates all required variables are present

How the community answered

(14 responses)
  • A
    7% (1)
  • B
    7% (1)
  • D
    86% (12)

Why each option

The `terraform init` command prepares the working directory by downloading plugins, configuring the backend, and sourcing modules, but it does not validate the presence of required input variables.

ASources all providers present in the configuration and ensures they are downloaded and

`terraform init` is responsible for discovering and downloading the necessary provider plugins specified in the configuration.

BConnects to the backend

`terraform init` connects to and configures the defined backend, which is essential for state management and collaboration.

CSources any modules and copies the configuration locally

`terraform init` sources any remote modules referenced in the configuration and copies them to a local `.terraform` directory.

DValidates all required variables are presentCorrect

`terraform init` focuses on setting up the environment, including downloading provider plugins, initializing the backend, and retrieving modules. It does not perform validation of the input variables; that task is typically handled by `terraform validate` or during `terraform plan` and `terraform apply` operations when values for required variables are needed.

Concept tested: terraform init command functionality

Source: https://developer.hashicorp.com/terraform/cli/commands/init

Topics

#terraform init#CLI commands#providers#modules

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice