As an engineering manager working with our Terraform provider, I get a lot of questions on how developers (including our own customers) use Terraform to manage cloud infrastructure.
Terraform is the ideal solution for some workloads, but for others, re-designing your workflows to incorporate Terraform can be a little like trying to reinvent the wheel. As with all tools, even if you don’t need to make the decision now, you should know the basics and keep an eye on development to see if Terraform will eventually be a good fit.
Terraform is an IaC solution that follows a declarative model; the configuration file defines how you want the final configuration to look, rather than defining the steps necessary to reach that configuration. See our blog post on the differences between declarative and imperative solutions for more details. Like other declarative tools, it’s best to use Terraform when the systems have some uniformity, although it provides some capacity for diverging from the standard template.
Pets vs Cattle
Terraform is not ideal for an environment where servers are special, or radically different from every other, or where individual systems are subject to frequent reconfiguration. It doesn’t have a problem with frequent configuration so long as it’s the thing doing the reconfiguration. A Terraform workflow wants to treat servers as cattle (not pets, i.e. not special).
Declarative solutions are also idempotent, meaning you get the same result no matter how many times you enter a command. Suppose a redeployment fails at some intermediate point of the configuration. In that case, you can enter the same command again rather than having to adapt the command or navigate the final configuration steps manually. Idempotent solutions tend to reduce the complexity of the troubleshooting process and therefore allow less experienced team members to operate with more independence.
In addition to the basic benefits of the declarative approach Terraform has several other advantages. The HashiCorp configuration language (HCL) used with Terraform is simpler and easier to learn than the languages used with many other IaC tools. You’ll only need a few commands to perform a large number of basic admin tasks. Terraform is an open source tool supported by many leading cloud providers, so using Terraform helps prevent vendor lock-in. The growing adoption of Terraform also means it’s becoming much easier to hire developers with Terraform experience.
Terraform is platform-agnostic and has a diverse collection of plugins making it easy to manage multi-cloud environments. The Terraform module registry offers reusable components that can save you time when you build your own configurations.
Linode and Terraform
We’ve invested heavily in Terraform, and the custom tools built into the Linode environment further simplify the task of implementing Terraform as your IaC solution. For example, the Linode Terraform provider interfaces directly with the Linode API, thus providing seamless integration with other Linode products.
This quick summary of benefits leads to some practical insights on when Terraform might be the best option for your environment. Consider Terraform if you have the following needs:
- Reproducible infrastructure: Automation operates best in an environment where there is some uniformity and reproducibility. If your network supports multiple systems that are similar in configuration, Terraform is an excellent choice. On the other hand, if your systems are dissimilar, require a lot of customization, or need frequent configuration changes, you probably won’t benefit from Terraform.
- External services: If you have an environment that requires integration with external tools and services, Terraform is a good choice because of its extensive collection of plugins.
- Multicloud: If your organization spreads across multiple cloud providers, the universal acceptance of Terraform will simplify integration.
- Flexible IT staffing: Terraform’s ease of use means you don’t have to be an expert to operate and maintain your IaC environment. Consider Terraform if your organization would benefit from an IT staff that is flexible and easy to train with minimal intervention from advanced-level specialists.
It is also important to keep in mind that today’s decisions will build the network you work in tomorrow, so think ahead when you are planning your IaC environment and considering Terraform. For instance, even if you aren’t operating in a multicloud environment today, you might wish to preserve the future option to save money and maximize flexibility as your organization evolves.
If you haven’t had the chance to work with Terraform for your own projects, it’s worth investing the time to get familiar with the tool so you can give yourself (and your workloads) an extra competitive advantage. Choosing a platform like Terraform that many different cloud providers support maximizes your power to adapt and future-proof your cloud infrastructure.