Your business depends on infrastructure, and the larger your business grows, the more you have to scale the infrastructure. Growth demands scale to a point where the number of components to make it possible can become overwhelming. Couple that with the teams involved with making such growth happen and the complications continue to mount.
That’s why you need to employ the right tools to make scaling not only possible but seamless and (almost) effortless. That means you’re looking at technology like containers, clouds, network appliances, Software as a Service (SaaS), Platform as a Service (PaaS), and Kubernetes. And managing external resources with various providers can add yet another layer of complexity to the mix.
A tool to help your business scale to meet demand
Terraform, by Hashicorp, is a declarative coding tool that makes it possible for developers to use a high-level configuration language, called HCL (HashCorp Configuration Language) to describe an end-state for your cloud or on-premise infrastructure to reach, for an application to run successfully.
This Infrastructure as Code (IaC) allows your developers to codify infrastructure and automate provisioning. By doing so, you can experience growth that’s faster, more reliable, and more repeatable (by preventing configuration drift).
Not only that, but by employing IaC, your developers can undertake more experimentation, testing, and optimization for your company’s apps and clouds.
So what makes Terraform the right choice for this task? Considering you have other options, such as Puppet, Chef, SaltStack, and Ansible, let’s take a look at why your business should consider this particular tool.
- Create promotions
- Manage an entire catalog of products
- Optimize your online store for search engines (SEO)
- Make it easy for customers to easily browse and search for your products
- Use easy one-page checkouts and shopping carts
- Save user credit card information
- Manage orders
- Offer customer account dashboards
- Offer plenty of customer service options
- Support mobile HTML5
- Support mobile apps for Android and iOS
- Integrate a wide range of checkout capabilities
For any business concerned about scaling, Magento has you covered. Magento 2.0 can:
- Process large numbers of orders per hour
- Handle near-instant server response times for catalog browsing
- Significantly reduce response times for cart and checkout pages
- Handle peak order volume, even with very large product catalogs, and customer lists
- Have simultaneous administrators on the backend
If you’re looking for one of the most powerful eCommerce platforms available, Magento is what you need.
Provisioning over configuration management
Tools like Puppet and Chef are known as configuration management tools. That means you can configure all of your data center (or cloud-based) servers and then deploy those configurations to the target servers from a single source. These types of tools are an amazing addition to any company that uses numerous servers and prefers to manage its configurations from a single controller.
Terraform, on the other hand, is a provisioning tool, which means they are designed to provision servers. That begs the question: what is provisioning?
Provisioning is the process of deploying IT infrastructure. In other words, you prepare a server for use by installing the operating system and any software required to serve your company. To provision servers manually can be very time-consuming. And when you’re tasked with provisioning a large number of servers, doing it manually can lead to many mistakes.
When provisioning with a tool like Terraform, you automate the process and achieve a level of scale and speed that you couldn’t by undertaking the task manually. With Terraform, you can provision servers, load balancers, databases, and network appliances. You can then use tools like Ansible and SaltStack to automate the configuration of those servers and services.
So it’s not a matter of one or the other, as they serve different jobs. For example, you could provision a cluster of servers with Terraform, configure them with SaltStack, and then orchestrate the deployment of containers with Kubernetes.
But at the foundation of that deployment chain is a tool like Terraform.
What is the Terraform process?
Terraform has a very specific workflow to take into consideration. The delivery of IaC looks like this:
Use declarative configuration files to create your Infrastructure as Code, making sure to use concise descriptions of all resources, such as:
resource “aws_instance” “example” { ami = “ami-408c7f28” instance_type = “t1.micro” monitoring = true vpc_security_group_ids = [ “sg-1436abcf”, ] tags = { Name = “Application Server” Environment = “production” } root_block_device { delete_on_termination = false } }
You can also define providers, such as:
provider “aws” { region = “eu-west-1” version = “~> 1.19” access_key = “${var.aws_access_key}” secret_key = “${var.aws_secret_key}” }
Once you’ve completed writing the HCL file, you must then check to see if the execution plan for the configuration matches what you expect for the provisioning. The plan command is run in the directory containing the HCL file, like so:
terraform plan
If all checks out, you then apply the HCL with the command:
terraform apply
The application of the HCL will then apply the changes to all of your resources, such that they reach the desired state.
And because Terraform is open-source and widely used, there are a large number of supported providers, such as:
- AWS
- Azure
- Google Cloud Platform
- Kubernetes
- Oracle Cloud Infrastructure
- Alibaba Cloud
- Active Directory
- Archive
- Boundary
- CISCO ASA
- Helm
- VMware vSphere
Once you’ve applied your states, you can also make use of Terraform’s Change Automation. With this feature, you can create very complex changesets that can be applied to your provisioned servers, with very little human interaction.
Terraform Use Cases
Let’s take a look at some popular use cases for Terraform.
- Register external services – Terraform can register external services by using the Consul provider.
- Codify Management of Vault – Vault is a service that stores and controls access to code secrets, such as tokens, passwords, and certificates. With Terraform you can automate the usage of Vault to reduce human error.
- Manage Kubernetes Resources – Terraform allows you to schedule Pod instances and expose them to network resources, using the Terraform Kubernetes Provider.
- Multi-Tier Applications – Terraform is an outstanding tool for building and managing N-tier architecture, with each tier described as a collection of resources.
- Self-Service Infrastructure – Terraform makes it possible to easily provision for teams in a “self-serve” manner, such that each team can then manage their own infrastructure with tooling provided by the provisioner.
- Disposable environments – With Terraform you can write HCL files for temporary environments that can be used briefly and then discarded. These environments can be used for testing purposes or Q&A.
Conclusion
Terraform is a remarkable platform that can help the provisioning of your infrastructure be more reliable, faster, and repeatable. Although there is a considerable learning curve with this tool, once you have the developers who know how to employ it, your company will grow faster and farther than you thought possible.