← 🏗️ Declarative Infrastructure
Core
State and drift: why infrastructure as code needs a ledger
Terraform state is not a cache and not an optimisation. It is the mapping between the names in your configuration and the identifiers in the provider, and without it there is no way to know whether a resource in your code is the same resource that exists in the cloud. Every confusing Terraform behaviour, from destroy and recreate to import, follows from what state is for.
a free account opens the core tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
Infrastructure as Code & Configurationcount versus for_each in Terraform: when does list ordering cause a destroy and recreate?→Infrastructure as Code & ConfigurationName three things in the Terraform state file, and explain why it is a security artifact rather than a cache.→Infrastructure as Code & ConfigurationTwo engineers run terraform apply against the same backend at the same time. What happens?→Infrastructure as Code & ConfigurationWhere does Terraform stop and Ansible start? Give me a case where using the wrong one hurts.→Infrastructure as Code & ConfigurationOne Terraform module tree, three environments. How do you lay out state so a production apply can never touch anything else?→Infrastructure as Code & ConfigurationFive hundred resources were built by hand over three years and must come under Terraform. Walk me through importing them without breakage.→