Test Online Free HashiCorp TA-002-P Exam Questions and Answers

The questions for TA-002-P were last updated On Sep.23 2022

Get TA-002-P Full Access
 / 7

Question No : 1
Why would you use the terraform taint command?

Answer:
Explanation:
The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply.
Reference: https://www.terraform.io/docs/cli/commands/taint.html

Question No : 2
}

Answer:
Explanation:
In a parent module, outputs of child modules are available in expressions as module. <MODULE NAME>.<OUTPUT NAME>.
For example, if a child module named web_server declared an output named instance_ip_address, you could access that value as module.web_server.instance_ip_address.

Question No : 3
Any user can publish modules to the public Terraform Module Registry.

Answer:

Question No : 4
Named workspaces are not a suitable isolation mechanism for strong separation between staging and production?

Answer:
Explanation:
Organizations commonly want to create a strong separation between multiple deployments of the same infrastructure serving different development stages (e.g. staging vs. production) or different internal teams. In this case, the backend used for each deployment often belongs to that deployment, with different credentials and access controls. Named workspaces are not a suitable isolation mechanism for this scenario. https://www.terraform.io/docs/state/workspaces.html#when-to-use-multiple-workspaces

Question No : 5
You wanted to destroy some of the dependent resources from real infrastructure. You choose to delete those resources from your configuration file and run terraform plan and then apply.
Which of the following way your resources would be destroyed?

Answer:
Explanation:
Terraform typically uses the configuration to determine dependency order. However, when you delete a resource from a Terraform configuration, Terraform must know how to delete that resource. Terraform can see that a mapping exists for a resource not in your configuration and plan to destroy. However, since the configuration no longer exists, the order cannot be determined from the configuration alone.
To ensure correct operation, Terraform retains a copy of the most recent set of
dependencies within the state. Now Terraform can still determine the correct order for destruction from the state when you delete one or more items from the configuration.

Question No : 6
You cannot publish your own modules on the Terraform Registry.

Answer:
Explanation:
Anyone can publish and share modules on the Terraform Registry.
https://www.terraform.io/docs/registry/modules/publish.html

Question No : 7
Jack is a newbieto Terraform and wants to enable detailed logging to find all the details.
Which environment variable does he need to set?

Answer:

Question No : 8
During a terraform apply, a resource is successfully created but eventually fails during provisioning.
What happens to the resource?

Answer:
Explanation:
If a creation-time provisioner fails, the resource is marked as tainted. A tainted resource will be planned for destruction and recreation upon the next terraform apply. Terraform does this because a failed provisioner can leave a resource in a semi-configured state. Because Terraform cannot reason about what the provisioner does, the only way to ensure proper creation of a resource is to recreate it. This is tainting.
You can change this behavior by setting the on_failure attribute, which is covered in detail below.
https://www.terraform.io/docs/provisioners/index.html#creation-time-provisioners
https://www.terraform.io/docs/provisioners/index.html#destroy-time-provisioners
https://www.terraform.io/docs/provisioners/index.html#failure-behavior

Question No : 9
Which of the below commands will rename a EC2 instance without destroying and recreating it?

Answer:

Question No : 10
1.If a module declares a variable with a default, that variable must also be defined within the module.

Answer:

 / 7
  TOP 50 Exam Questions
Exam