Back to articles
Managing Terraform State: Best Practices for DevOps
How-ToDevOps

Managing Terraform State: Best Practices for DevOps

via Dev.to DevOpsUdoh Deborah

Introduction If Day 5 was about building scaled infrastructure, Day 6 was about understanding what keeps it all together terraform state. Today I migrated from local state to a fully remote S3 backend with state locking, and the difference between the two is not a small thing. It is the difference between infrastructure you can trust and infrastructure that is one concurrent run away from disaster. What is Terraform State? Every time you run terraform apply , Terraform writes a file called terraform.tfstate . This JSON file is Terraform's complete record of everything it manages — every resource, every attribute, every dependency. It is not a log. It is the source of truth. When you run terraform plan , Terraform does three things: Reads your configuration code Reads the state file Queries real AWS infrastructure It then calculates the difference between what your code says should exist and what actually exists. Without state, none of this is possible. Terraform would have no way to kn

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
5 views

Related Articles