DEV Community

Romanus Onyekwere
Romanus Onyekwere

Posted on

Create a Virtual Machine on Azure Using Terraform

Terraform is an infrastructure as code (IAC) tool that enables us to define and manage infrastructure resources in a declarative way, making it easier to automate the provisioning, deployment, and management of our cloud resources. With Terraform, we can easily and consistently create and manage our Azure infrastructure resources, such as resource groups and VMs, among others.

Virtual Machine (VM) provisioning on Azure can be a seamless process when leveraging Terraform, an Infrastructure as Code (IaC) tool. This article guides you through the quick and efficient steps to create a VM on Azure using Terraform.
Image description

Step 1; Install terraform Software
On the web browser, download Terraform and install window AMD64

Image description
Locate the terraform folder, unzip it

Image description

Extract the file

Image description
Highlight and copy the location terraform text
Search environmental variable at the left lower search bar

Image description
Click environmental variable
Image description
Click on path
Click on edit

Image description
Click on new to create a position to paste the copied terraform text
Click OK

Open the terminal of Vscode and input the terraform space dash version

Image description

Create a new terraform Configuration file
In the Vscode, open a file (terraform)

Image description

In the working directory create a file main.tf and paste the terraform configuration on it

Image description
Save the file
Initialise and apply Terraform configuration

In the Git bash, run the following command to initialise the Terraform configuration: terraform init

Image description

Image description

I will continue later. This prompt is saying ;

the directory has no terraform configuration files

Top comments (0)