HashiCorp Certified: Terraform Associate (003) (HCTA0-003) Questions and Answers
Question 73
Using the terraform state rm command against a resource will destroy it.
Options:
A.
True
B.
False
Answer:
B
Explanation:
The terraform state rm commandremovesa resource from Terraform’s state file butdoes not destroythe resource in the actual infrastructure. It only removes Terraform’s knowledge of the resource, meaning Terraform will no longer manage it.
If you run terraform state rm on a resource, Terraform will forget that the resource exists.
However, the resource will still exist in the cloud or infrastructure provider.
If you later run terraform apply, Terraform may try torecreatethe resource because it is no longer present in its state file.
Official Terraform Documentation Reference:
terraform state rm - HashiCorp Documentation
Question 74
What does Terraform not reference when running a terraform apply -refresh-only ?
Options:
A.
State file
B.
Credentials
C.
Cloud provider
D.
Terraform resource definitions in configuration files
Answer:
D
Explanation:
When running a terraform apply -refresh-only, Terraform does not reference the configuration files, but only the state file, credentials, and cloud provider. The purpose of this command is to update the state file with the current status of the real resources, without making any changes to them1.