Monday, November 9, 2020

How does Terraform stores state information Remotely | Terraform state Best practices | Terraform Remote state store

One of the things that Terraform does (and does really well) is to “track” 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 State Management Best practices:
1. Never store state file locally. store in remote places such as AWS S3, Azure blob storage.
2. Always create versioning for remote state file incase if you loose your remote state file or file is corrupted.
3. Never make any manual changes to the state file as it is a JSON file can be modified
4. Always create state file per environment
5. Deploy infrastructure changes using CICD tools instead of manually doing it 

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.


Please click here to learn how to automate infra set up using Jenkins and Terraform.


1 comment:

  1. Usually, the bonuses are not redeemable till you play a set number of palms or video games. And when eligible to be redeemed, it’s usually in specific increments and solely after the bonus cash is wagered a number of} instances. There are greater than a half-dozen on-line poker sites in New Jersey, including the well-known PokerStars and WSOP. In addition, New Jersey joined a three-state agreement with Nevada and Delaware to share participant pools, increasing the number of out there gamers. One of the state’s high income producers – each on-line and land-based. Owned by MGM Mirage, Borgata's on-line web site offers slots, poker and bingo, quantity of|various|a variety of} other|and quantity of} other} kinds of blackjack and video poker 메리트카지노 on its desk sport menu.

    ReplyDelete

DevSecOps Bootcamp Dec 2024 Schedule | DevSecOps & AWS Azure Cloud Coaching by Coach AK | DevSecOps and Cloud Computing Online Classes

Lot of new topics covered like GitHub Actions, GitHub Advanced Security, Helm, Prometheus and Grafana..) The DevOps requirements in the IT m...