From the course: Learning Terraform

What is Terraform?

- [Instructor] I'm guessing you already have some idea what Terraform is, but let's review. Terraform is an infrastructure management tool made by HashiCorp, that lets you provision, manage, and maintain cloud resources, servers, networking, storage, etcetera, all in one centralized set of code. So Terraform is a tool, a command line program, and a cloud-based application you run to define and make changes to your infrastructure, but Terraform is also a language that defines those changes. Terraform is for managing the base infrastructure itself. For example, creating a server instance, and placing it behind a load balancer. Terraform can't really change what's running on that server once it's deployed, for that, you'll need a config management tool. So Terraform will create the server, and then you might use something like Puppet to turn that server into a web server with your specific application code running on it. You might think of Terraform as setting up a blank canvas, but you still need other tools to paint the picture. It's possible to run a tool like Puppet on a system using a Terraform feature called provisioners, but we are intentionally not covering them in this course. The official Terraform docs describe provisioners as a last resort, and I agree, although I can see how they could be amazingly powerful if you're already using config management. So if we won't use config management, what's our other option? Terraform is really well suited to deploy pre-made server images, where all the configuration is already set. You'll still need to create your base image, and there's another great HashiCorp tool for that called Packer. If you've set things up correctly with a load balancer, and an application that can tolerate cycling server instances, you can use Terraform to maintain and update systems by destroying and replacing them with new instances. The purest form of this is called immutable infrastructure, where system discs are actually read only, config and software can only be updated by replacing the instance. Even if you don't go to that extreme, being able to freely throw away and replace any instance is a total game changer. For me, that leap has drastically reduced my background anxiety around site stability and on call shifts. Finally, we get to containers. Terraform is able to manage these, but it's beyond the scope of what we'll cover in this course. Terraform is able to work directly with Docker and Kubernetes offering a couple of approaches for container based workloads. That support for Kubernetes could even be paired with Amazon's Kubernetes Service, or another cloud provider. You could even use Terraform to provision a Kubernetes cluster on a cloud provider, and then use the Terraform Kubernetes provider to provision resources in that cluster.

Contents