Monday, November 9, 2020

How does Terraform stores state information | Terraform state Best practices

One of the things that Terraform does (and does really well) is “tracks” your infrastructure that you provision. It does this through the means ofstate.

Terraform state is used to reconcile deployed resources with Terraform configurations. State allows Terraform to know what resources to add, update, or delete. 

This state is stored by default in a local file named "terraform.tfstate", but it can also be stored remotely, which works better in a team environment. 

Why state file should not be stored in your local machine?

  • Local state doesn't work well in a team or collaborative environment.
  • Terraform state can include sensitive information.
  • Storing state locally increases the chance of inadvertent deletion.

Terraform uses this local state to create plans and make changes to your infrastructure. Prior to any operation, Terraform does a refresh to update the state with the real infrastructure.

Terraform state can include sensitive information. Storing state locally increases the chance of inadvertent deletion. Terraform supports the persisting of state in remote storags such Azure Storage or AWS S3 bucket

Please watch the steps in YouTube channel to learn how to store state file in S3 Bucket.


No comments:

Post a Comment

DevOps Coaching Program Model Information | AWS Cloud Azure Cloud DevOps Coaching Program Model Information

Thanks for showing interest in learning DevOps. Believe it or not, anyone can become a successful DevOps engineer after finishing the excit...