Writing a Terraform script to deploy an Azure infrastructure
To illustrate the use of Terraform to deploy resources in Azure, we will provide a simple Azure architecture with Terraform that is composed of the following components:
- There's an Azure resource group.
- There's also a network configuration that is composed of a virtual network and a subnet.
- In this subnet, we will create a virtual machine that has a public IP address in order to be publicly available.
To do this, in the same directory where we previously created the provider.tf
file, we will create a main.tf
file with the following code:
- Let's start with the code that provides the
resource
group:resource "azurerm_resource_group" "rg" { name = "bookRg" location = "West Europe" tags { environment = "Terraform Azure"...