What exactly is Terraform and how does it work?
A brief description of what Terraform is and how it can be useful.
Sometimes it helps to have a succinct explanation of things. Here's a recap of Terraform:
- Terraform is an infrastructure management tool made by HashiCorp.
- Its primary purpose is to allow administrators to provision, manage, and maintain cloud resources.
- Terraform is a tool and a language.
- As a tool, it's a command-line program and a cloud-based application you run to make changes.
- As a language, it's a structure/format that defines those changes.
- Terraform is not the same thing as a "config management tool" for resources. It's not really intended to change what's running once it's deployed.
- Think of it like this: terraform might create a server in a cloud environment... and then you might use something like puppet to turn that server into a web server.
- Analogy: think of terraform as setting up a blank canvas but you still need other tools to "paint the picture".
- Terraform is really well suited to deploy pre-made server images, where all the configuration is already set.
- Terraform can work with Docker and Kubernetes, offering a couple of approaches for container-based workloads.
I especially like this breakdown of the play-by-play by, courtesy of Josh Samuelson in his LinkedIn Learning course:
...Terraform is taking the infrastructure described in your code and comparing it to the state of what actually exists, and then essentially writing a step-by-step script that will make the changes. The plan step is critical because it's the bit that figures out what needs to be done and in what order. Then terraform uses the provider to actually apply the plan and make whatever changes are needed.