nerdexam
HashiCorp

TA-002-P · Question #315

A user runs terraform init on their RHEL based server and per the output, two provider plugins are downloaded: $ terraform init Initializing the backend... Initializing provider plugins... -Checking…

The correct answer is B. The .terraform/plugins directory in the directory terraform init was executed in. Terraform provider plugins are downloaded by terraform init into the .terraform/plugins subdirectory within the working directory.

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

Question

A user runs terraform init on their RHEL based server and per the output, two provider plugins are downloaded: $ terraform init Initializing the backend... Initializing provider plugins... -Checking for available provider plugins... -Downloading plugin for provider "aws" (hashicorp/aws) 2.44.0... -Downloading plugin for provider "random" (hashicorp/random) 2.2.1... :

Terraform has been successfully initialized! Where are these plugins downloaded to?

Options

  • AThe .terraform.plugins directory in the directory terraform init was executed in.
  • BThe .terraform/plugins directory in the directory terraform init was executed in.
  • C/etc/terraform/plugins
  • DThe .terraform.d directory in the directory terraform init was executed in.

How the community answered

(38 responses)
  • A
    5% (2)
  • B
    92% (35)
  • C
    3% (1)

Why each option

Terraform provider plugins are downloaded by `terraform init` into the `.terraform/plugins` subdirectory within the working directory.

AThe .terraform.plugins directory in the directory terraform init was executed in.

The directory name `'.terraform.plugins'` is incorrect; the correct path is `.terraform/plugins`.

BThe .terraform/plugins directory in the directory terraform init was executed in.Correct

When `terraform init` is executed, it downloads necessary provider plugins and stores them in a local directory to manage their versions and ensure availability for the configuration. By default, these plugins are placed in the `.terraform/plugins` directory within the current working directory where `terraform init` was run.

C/etc/terraform/plugins

`/etc/terraform/plugins` is a system-wide directory and not the default location for locally downloaded provider plugins by `terraform init`.

DThe .terraform.d directory in the directory terraform init was executed in.

The directory name `'.terraform.d'` is not the standard location for Terraform provider plugins; the correct path is `.terraform/plugins`.

Concept tested: Terraform provider plugin local storage

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

Topics

#terraform init#provider plugins#local file storage#Terraform project structure

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice