Terraform with Microsoft Azure

Hi Friends,

In this section, thought to start a discussion on the lines of Infrastructure as code aka IAC. This is something which is not new with code-base which we generally maintain to write our application logic. We generally keep our code base in GIT, BitBucket or any other source control. This helps a lot in terms of sharing code across teams, merging their PRs etc.

Similarly, its entirely OK to apply similar concept to infrastructure system by converting them as script. This means that all the infrastructure piece, deployables, config files can be stored in git, hence it can be versioned. It can be easily rolled back, it can be easily deployed to different environments without any overhead.

  • This also means that automation can be done very easily. We can also apply CI/CD on this as well. Terraform is an open source tool developed and maintained by HashiCorp. Its goal is pretty simple and it helps to make deployment easy and readable.
  • Microsoft also has ARM templates which does the exact same thing. But, it stores configurations, settings, etc in JSON format. And sometimes, JSON becomes scary, if you even miss a single comma (,).
  • It also comes with a set of tools which makes deployment very easy. These all things, we will discuss in detail with demo in coming section.
  • Terraform works with bunch of cloud providers. For every cloud provider, implementation is different. But of course readable. Here, you can see the complete list of supported platforms. Link:- https://www.terraform.io/docs/providers/
  • Terraform uses its own language HCL (Hashicorp Configuration Language).

Let’s say we are using common components like listed below irrespective of environment

  • Virtual machines
  • VNet, Subnets
  • Cosmos DB, SQL,
  • AKS
  • Container Registry
  • Gateway
  • Azure monitor, Metrics,
  • Log Analytics

Since these are part of common infrastructure, hence these can be considered as part IAC using terraform

This post is mostly setting the tone for upcoming posts. I will try to touch upon all the nuts and bolts associated with these in coming posts. Till then stay tuned and happy coding.

Rahul Sahay
Happy Coding

277 total views, 1 views today