Skip to main content

An introduction to Terraform with Azure

What is Terraform?

Terraform is a utility for managing infrastructure as code; it works across most cloud providers with on premise infrastructure platforms as a service (iPaaS). We use Terraform when we want to rapidly deploy the infrastructure (for example in disaster recovery).

Terraform uses declarative configuration files meaning they can be managed just like any other in the environment. They can be stored in source control, shared, versioned and deleted. The way the configuration files are structured simplifies mapping multiple resources and dependencies together. Terraform is modular, and allows for a central deployment to be used with multiple providers, thereby not limiting an organisation to just one platform.

Terraform on AZURE

Terraform integrates with Azure and Azure DevOps, enabling teams to integrate infrastructure as code for managing Azure resources directly into the build, and release automation pipelines. There are different kinds of components like Azure virtual machines, virtual networks, subnets, and Azure Kubernetes services that can be deployed through Terraform.

Terraform is configured using plugins which you can enable once you download and install the executable file on your machine.

Terraform plugins are built into the Azure CLI and PowerShell tools within the Azure portal. Regardless of the tool the respective Terraform plugin will help directly validate and deploy your Terraform module. As it has interactive login we can use Azure CLI authentication during the development or testing phase.

How do I deploy Infrastructure to Azure?

  1. Create a Terraform module of *.tf files and dependent configuration files.
  2. Terraform initialisation.
  3. Azure authentication.
  4. Terraform deployment, state file creation.
  5. Terraform execution plan.
  6. Apply the plan.

CI/CD with Azure Terraform

We can build a CI/CD pipeline using Terraform and Azure DevOps. With the help of a CI/CD pipeline we can deploy your infrastructure and test the environment at the same time. We can integrate the terraform with both Docker and Kubernetes.

Terraform Use Cases

  • Multi-Cloud Deployment

Terraform is cloud-agnostic and allows single configuration to be used with multiple cloud providers and cross-cloud dependencies. This helps in building and managing large-scale multi-cloud infrastructures.

  • Multi-Tier Applications

Terraform can be used in building and managing N-tier architecture, which is a combination of an interdependent pool of webservers, API-servers, load balancers and database servers etc. This infrastructure can be scaled using Terraform’s inbuilt features.

  • Software Defined Networking

Terraform can be used to codify the configuration for SDN; this can be used to automate the setup of Azure and Azure network components.

  • Disposable Environments

With Terraform we can codify the production environment and then use the Terraform modules with staging, QA or dev, so that we can rapidly deploy and test the new environment (which we can then dispose if we do not need it). With this process we can maintain parallel environments.

  • Software Demos

Software developers can use the features of Terraform to quickly deploy the software on the infrastructure created by Terraform, and easily demo the software and test.

  • Self-Service Clusters

All the services (resources) can be codified in a configuration, where we share the code within different teams in the organisation and use those artifacts to manage different customer infrastructure requirements.

If you would like to find out more about Azure our Big Data experts can help you.  Do give us a call at +44 (0)203 475 7980 or email us at Salesforce@coforge.com

Other useful links:

The use of Data in 2020 and beyond

Coforge Case Studies

Coforge partners with Microsoft Azure

Let’s engage