nerdexam
HashiCorp

TA-002-P · Question #372

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

The correct answer is B. False. The terraform state rm command removes a resource's record from the Terraform state file, but it does not destroy the actual infrastructure resource in the cloud provider.

Implement and maintain state

Question

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

Options

  • ATrue
  • BFalse

How the community answered

(65 responses)
  • A
    11% (7)
  • B
    89% (58)

Why each option

The terraform state rm command removes a resource's record from the Terraform state file, but it does not destroy the actual infrastructure resource in the cloud provider.

ATrue

This statement is false because terraform state rm only modifies the state file, not the deployed infrastructure.

BFalseCorrect

The terraform state rm command is used to remove an item from the Terraform state file. It only de-associates Terraform's management from that resource, meaning Terraform will no longer track or manage it, but the actual resource in the cloud or on-premise environment remains intact.

Concept tested: Terraform state management - terraform state rm

Source: https://developer.hashicorp.com/terraform/cli/commands/state/rm

Topics

#terraform state#state management#terraform CLI#resource lifecycle

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice