Skip to main content
InterviewHubPRO
Section Overview
Q9

Question 9 of 50

Part 1: Terraform Core Architecture, HCL & Providers (1 - 15)

18%
Terraform & IaC (50 Qs)•Part 1: Terraform Core Architecture, HCL & Providers (1 - 15)

Explain Critical State Management Commands: `state rm`, `state mv`, and `state list`.

senior LevelMost AskedState ManagementFormsCI/CD & DevOps

In Simple Words:

  • terraform state list: Lists all resources currently tracked in the state file.
  • terraform state show <resource>: Displays all attributes of a specific tracked resource.
  • terraform state rm <resource>: Removes a resource from state tracking without destroying the actual cloud resource. Useful when retiring Terraform management or moving resources.
  • terraform state mv <source> <dest>: Renames a resource in state without triggering destroy/re-create during the next apply.