Provisioning Cloud Infrastructure with Terraform
In the previous chapter, we introduced the tools, practices, and benefits of Infrastructure as Code (IaC) and its impact on DevOps culture. Out of all of the IaC tools that have been mentioned, one that is particularly powerful is Terraform, which is part of the HashiCorp tools suite.
In this chapter, we will look at the basics of using Terraform to provision a cloud infrastructure, using Azure as an example. We will start with an overview of its strengths compared to other IaC tools. We will see how to install it in both manual and automatic mode, and then we will create our first Terraform script to provision an Azure infrastructure with the use of best practices and its automation in a CI/CD process. Finally, we will go a little deeper with the implementation of a remote backend for tfstate.
In this chapter, the following topics will be covered:
- Installing Terraform
- Configuring Terraform for Azure
- Writing a Terraform script to deploy an Azure infrastructure
- Running Terraform for deployment
- Understanding the Terraform's life cycle with the different command-lines options
- Protecting the tfstate file with a remote backend