Running Terraform using GitHub Actions
In the last four chapters, we have talked about Terraform a lot – however, we are yet to address the elephant in the room – state files.
As we have been running Terraform locally, we haven’t really needed to talk about state files in too much detail yet, so let’s look at them now before we discuss how we can run Terraform using GitHub Actions.
Terraform state files
Every time we run Terraform, a file called terraform.tfstate
is either created, updated, or read. It is a JSON formatted file containing information about the resources created or modified by Terraform. It includes details such as the IDs, IP addresses, and other metadata associated with each resource we manage with Terraform.
Terraform uses this file to keep track of the current state of the infrastructure to determine what changes must be made when you modify your infrastructure code.
The state file is absolutely critical to the correct operation...