Terraform-Associate-004 practice question 4 of 35

Using the terraform state rm command against a resource will destroy it.

Full set: 360 questions
Answer options
A: True
B: False
Correct Answer:
FALSE
Explanation

The terraform state rm command removes the record of a resource from the Terraform state file. This action does not destroy the actual, real-world infrastructure object. It simply tells Terraform to no longer manage that resource. The resource will continue to exist in the cloud provider's environment, but it becomes "orphaned" from the Terraform configuration that created it. To destroy the infrastructure itself, you must use the terraform destroy command.

Why Incorrect

The statement is false because it incorrectly equates state file manipulation with infrastructure lifecycle management. The terraform state subcommand family is designed for advanced state manipulation, which is separate from the standard plan/apply/destroy workflow that affects real resources.

References

1. HashiCorp Terraform Documentation, "Command: state rm": The official documentation explicitly states, "This does not destroy the infrastructure represented by the item, but it does remove the binding from the state. If you want to destroy the item, use terraform destroy instead." This directly refutes the premise of the question.

Source: HashiCorp Terraform CLI Documentation, developer.hashicorp.com/terraform/cli/commands/state/rm

2. HashiCorp Learn, "Manage Resources in Terraform State": This official tutorial provides a practical example and clarifies the command's purpose. In the section "Remove a resource from Terraform state," it guides the user to run terraform state rm and then confirms, "Terraform no longer manages this S3 bucket, but the bucket still exists in your AWS account."

Source: HashiCorp Learn, developer.hashicorp.com/terraform/tutorials/state/state-rm

Scroll to Top