nerdexam
HashiCorp

TA-002-P · Question #345

Which task does teraform init not perform?

The correct answer is B. Validates all required variables are present. The terraform init command prepares a Terraform working directory by downloading providers and modules and initializing the backend, but it does not validate that all required variables are present.

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

Question

Which task does teraform init not perform?

Options

  • ASources any modules and copies the configuration locally
  • BValidates all required variables are present
  • CConnects to the backend
  • DSources all providers present in the configuration and ensures they are downloaded and available

How the community answered

(31 responses)
  • B
    90% (28)
  • C
    3% (1)
  • D
    6% (2)

Why each option

The `terraform init` command prepares a Terraform working directory by downloading providers and modules and initializing the backend, but it does not validate that all required variables are present.

ASources any modules and copies the configuration locally

`terraform init` downloads and copies modules used in the configuration, making them available for use.

BValidates all required variables are presentCorrect

`terraform init` primarily sets up the working directory, downloading necessary components and configuring the backend. Variable validation, specifically checking if all required variables have been provided values, is a task performed during planning (`terraform plan`) or applying (`terraform apply`) rather than initialization.

CConnects to the backend

`terraform init` establishes the connection to the configured backend, which is essential for state management and collaboration.

DSources all providers present in the configuration and ensures they are downloaded and available

`terraform init` discovers and downloads the necessary provider plugins specified in the configuration, ensuring they are available for resource management.

Concept tested: Terraform init command functionalities

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