TA-002-P · Question #325
When using providers that require the retrieval of data, such as the HashiCorp Vault provider, in what phase does Terraform actually retrieve the data required?
The correct answer is C. terraform init. The terraform init phase is where Terraform discovers, downloads, and installs the necessary provider plugins, retrieving the binary data required for providers to function.
Question
When using providers that require the retrieval of data, such as the HashiCorp Vault provider, in what phase does Terraform actually retrieve the data required?
Options
- Aterraform delete
- Bterraform plan
- Cterraform init
- Dterraform apply
How the community answered
(52 responses)- A2% (1)
- B2% (1)
- C90% (47)
- D6% (3)
Why each option
The `terraform init` phase is where Terraform discovers, downloads, and installs the necessary provider plugins, retrieving the binary data required for providers to function.
`terraform destroy` is used for tearing down infrastructure and does not involve the initial retrieval or setup of provider data or plugins.
While `terraform plan` evaluates configuration and may retrieve data for `data` sources, the initial retrieval and installation of the provider plugins themselves occur during the `init` phase.
During the `terraform init` phase, Terraform discovers and installs the required provider plugins into the working directory, which involves retrieving the provider binaries and preparing them for use in subsequent plan and apply operations.
`terraform apply` executes the planned changes and interacts with providers, but the initial retrieval and setup of the provider plugins are completed during `init`.
Concept tested: Terraform initialization phase
Source: https://developer.hashicorp.com/terraform/cli/commands/init
Topics
Community Discussion
No community discussion yet for this question.