When executing the Terraform workflow commands, which are mainly terraform plan, terraform apply, and terraform destroy, Terraform has a mechanism that allows it to identify which resources need to be updated, added, or deleted. To perform this mechanism, Terraform maintains a file called a Terraform state file that contains all the details of the resources provisioned by Terraform. This Terraform state file is created the first time the terraform plan command is run and is updated with each action (apply or destroy).
In a enterprise, this file contains certain interesting aspects, which are as follows:
- Sensitive information on the provisioned resources is mentioned in clear text.
- If several people are working together, this file must be shared by everyone or, by default, this file is created on the local workstation or on the workstation that contains the Terraform binary.
- Even if it is archived in a Git source code manager, once...