Spinning up instances with Terraform in Azure and AWS

Sahitya Maruvada
5 min readJul 18, 2019

When I first started working on Terraform with a little knowledge of AWS and Azure there were several blog posts and of course the official documentation to aid me throughout the process. This article aims to be a beginner-friendly guide giving information on what resources are required to create a virtual machine in a crisp and easy manner. The goal of this post is to give a basic idea of creating a Virtual Machine in AWS and Azure focussing more on Azure and also about the concepts that I learned the hard way.

This assumes that you have installed Terraform, if that isn’t the case, the installation procedure can be found at Terraform’s official website

Terraform Directory Layout:

The files that are used to describe infrastructure and aid in initializing resources in terraform are created with an extension .tf

Creating the first terraform file:

It is ideal to create a folder and then include a main.tf in it. The required plugins (AWS or Azure) are downloaded when we initialize terraform with terraform init

The directory layout with a single terraform (.tf) file would be as follows

--- terraform_repo
|--- .terraform # plugin downloads
|--- main.tf # provider and resource…

--

--

Sahitya Maruvada

Tech and Travel Enthusiast!! Software Engineer by profession!! Writing on Medium is my way of giving back to the dev community 😃