HashiCorp Certified: Terraform Associate (003) (HCTA0-003) Questions and Answers
Question 73
When should you run terraform init?
Options:
A.
Every time you run terraform apply
B.
Before you start coding a new Terraform project
C.
After you run terraform plan for the time in a new terraform project and before you run terraform apply
D.
After you start coding a new terraform project and before you run terraform plan for the first time.
Answer:
D
Explanation:
You should run terraform init after you start coding a new Terraform project and before you run terraform plan for the first time. This command will initialize the working directory by downloading the required providers and modules, creating the initial state file, and performing other necessary tasks. References = : Initialize a Terraform Project
Question 74
You can access state stored with the local backend by using terraform_remote_state data source.
Options:
A.
True
B.
False
Answer:
B
Explanation:
You cannot access state stored with the local backend by using the terraform_remote_state data source. The terraform_remote_state data source is used to retrieve the root module output values from some other Terraform configuration using the latest state snapshot from the remote backend. It requires a backend that supports remote state storage, such as S3, Consul, AzureRM, or GCS. The local backend stores the state file locally on the filesystem, which terraform_remote_state cannot access.
[References:, Terraform documentation on terraform_remote_state data source: Terraform Remote State Data Source, Example usage of remote state: Example Usage (remote Backend), , , , , ]