Tutorial: How to Deploy a Linux VM in Microsoft Azure Cloud

Tutorial: How to Deploy a Linux VM in Microsoft Azure Cloud

6 January 2023

Guilherme Melo

In this article, we will learn how to deploy a Linux VM instance in Microsoft Azure Cloud using Terraform. We will create a step-by-step deployment of a Linux virtual machine with extra disks using Terraform to guide and optimize the deployment process.

Requirements

  • Credentials of a Service Principal who will execute Terraform code;
  • Create a Resource Group
  • Create a Virtual Network and Subnet
  • Create a Shared Image or Image

Tree Structure

Creating a Terraform file for Azure authentication

First, we will create a file called provider.tf to be used by Azure authentication.

We will need a Subscription ID, Tenant ID, Service Principal ID, and the Secret of the Service Principal.

Add the following code to the file and fill in the inputs:

 

terraform {
 required_providers {
   azurerm = {
     source = "hashicorp/azurerm"
     version = "3.30.0"
   }
 }
}
 
provider "azurerm" {
 subscription_id   = "<azure_subscription_id>"
 tenant_id         = "<azure_subscription_tenant_id>"
 client_id         = "<service_principal_appid>"
 client_secret     = "<service_principal_password>"
}

The version in the required_providers azurerm section is useful to pin a specific version, but is not required.

Creating a Terraform file for Linux VM

Now, create the compute.tf file to build the Azure VM Instance. We will split the code for better clarity. Initially, we will fetch Data of the previously created Resource Group and Subnet.

 

data "azurerm_resource_group" "rg" {
 name = var.rg_name
}
 
data "azurerm_subnet" "sub" {
 name                 = var.subnet_name
 virtual_network_name = var.vnet_name
 resource_group_name  = var.rg_name
}

This section of code will create a Network Interface and assign a Public IP (if necessary).

 

resource "azurerm_public_ip" "pip" {
 count = var.private_ip_address == null ? 1 : 0
 
 name                = "pip-${var.vm_name}"
 resource_group_name = data.azurerm_resource_group.rg.name
 location            = var.location
 allocation_method   = var.public_ip_allocation
 sku                 = "Standard"
 
 tags = var.tags
}
 
resource "azurerm_network_interface" "nic" {
 name                = "nic-${var.vm_name}"
 location            = var.location
 resource_group_name = data.azurerm_resource_group.rg.name
 
 ip_configuration {
   name                          = "internal"
   private_ip_address_allocation = var.private_ip_address == null ? "Dynamic" : "Static"
   private_ip_address_version    = "IPv4"
   subnet_id                     = data.azurerm_subnet.sub.id
   private_ip_address            = var.private_ip_address
   public_ip_address_id          = var.private_ip_address == null ? join("", azurerm_public_ip.pip.*.id) : null
 }
 tags = var.tags
}

This section of code will create the VM Instance.

 

resource "azurerm_linux_virtual_machine" "vm" {
 name                     = var.vm_name
 location                 = var.location
 resource_group_name      = data.azurerm_resource_group.rg.name
 size                     = var.vm_size
 admin_username           = var.username
 admin_password           = var.password
 network_interface_ids    = [azurerm_network_interface.nic.id]
  os_disk {
   caching                = "ReadWrite"
   storage_account_type   = var.bootdisk_type
   disk_size_gb           = var.bootdisk_size
 }
 
 source_image_reference {
     publisher = var.image.os_publisher
     offer     = var.image.os_offer
     sku       = var.image.os_sku
     version   = var.image.os_version
 }
 
 boot_diagnostics {
   #When empty utilize a Platform-Managed Storage Account.
 }
 
 identity {
   type = "SystemAssigned"
 }
 
 tags = var.tags
 
 depends_on = [azurerm_network_interface.nic]
}

Finally, this section of code will create Managed Disks and attach to the VM.

 

resource "azurerm_managed_disk" "disk" {
 for_each = var.managed_disk
 
 name                   = "${var.vm_name}-${each.value.name}"
 location               = var.location
 resource_group_name    = data.azurerm_resource_group.rg.name
 storage_account_type   = each.value.disk_type
 create_option          = "Empty"
 disk_size_gb           = each.value.disk_size
 
 depends_on = [azurerm_windows_virtual_machine.vm]
}
 
resource "azurerm_virtual_machine_data_disk_attachment" "atch" {
 for_each = azurerm_managed_disk.disk
 
 managed_disk_id    = each.value.id
 virtual_machine_id = azurerm_windows_virtual_machine.vm.id
 lun                = index(keys(azurerm_managed_disk.disk), each.key)
 caching            = "ReadWrite"
 
 depends_on = [azurerm_managed_disk.disk]
}

Creating a Terraform file for variables

In this step, we will create the file variables.tf to configure the variables.

Add the following code to the file:

 

##Data Variables##
variable "rg_name" {
 type = string
}
 
variable "vnet_name" {
 type = string
}
 
variable "subnet_name" {
 type = string
}
 
##NIC Variables##
variable "public_ip_allocation" {
 type = string
}
 
variable "private_ip_address" {
 type = string
}
 
##Compute Variables##
variable "location" {
 type = string
}
 
variable "vm_name" {
 type = string
}
 
variable "vm_size" {
 type = string
}
 
variable "username" {
 type = string
}
 
variable "password" {
 type = string
}
 
variable "bootdisk_size" {
 type = string
}
 
variable "bootdisk_type" {
 type = string
}
 
variable "image" {
 type = object({
   os_publisher = string
   os_offer     = string
   os_sku       = string
   os_version   = string
 })
 default = {
   os_offer     = null
   os_publisher = null
   os_sku       = null
   os_version   = null
 }
}
 
##Disks Variables##
variable "managed_disk" {
 default = {}
 
 type = map(object({
   name      = string
   disk_type = string
   disk_size = number
 }))
}
 
variable "tags" {
 type = map(string)
}

Input definition variables

We can define the variables that we created before by creating a .tfvars file, a module, or by using Terraform Cloud.

How to find Ubuntu VM image references for Terraform

There are two options to find Ubunty VM image references:

You can open the AZ CLI tool or the Cloud Shell in the Azure Console and enter the following command:

az vm image list –offer Ubuntu

Alternatively, you can access the Azure VM Image List.

Optional: bootstrapping the VM instance with Bash

We can also use a Bash script to bootstrap the VM instance. This extra step is useful to avoid having to manually mount the disks.

resource "azurerm_virtual_machine_extension" "disk_formatter" {
 count = azurerm_managed_disk.disk != {} ? 1 : 0
 
 name                 = "CustomScript"
 virtual_machine_id   = azurerm_linux_virtual_machine.vm.id
 publisher            = "Microsoft.Azure.Extensions"
 type                 = "CustomScript"
 type_handler_version = "2.1.1"
 protected_settings   = <<-PROTECTED_SETTINGS
 {
   "script": "IyEvYmluL2Jhc2gKCmhlbHAoKQp7CiAgICBlY2hvICJVc2FnZTogJChiYXNlbmFtZSAkMCkgWy1iIGRhdGFfYmFzZV0gWy1oXSBbLXNdIFstbyBtb3VudF9vcHRpb25zXSIKICAgIGVjaG8gIiIKICAgIGVjaG8gIk9wdGlvbnM6IgogICAgZWNobyAiICAgLWIgICAgICAgICBiYXNlIGRpcmVjdG9yeSBmb3IgbW91bnQgcG9pbnRzIChkZWZhdWx0OiAvZGF0YWRpc2tzKSIKICAgIGVjaG8gIiAgIC1oICAgICAgICAgdGhpcyBoZWxwIG1lc3NhZ2UiC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ICAgIGZpCn0KCiMgQ3JlYXRlIFBhcnRpdGlvbnMKRElTS1M9JChzY2FuX2Zvcl9uZXdfZGlza3MpCgppZiBbICIkUkFJRF9DT05GSUdVUkFUSU9OIiAtZXEgMSBdOyB0aGVuCiAgICBjaGVja19tZGFkbQogICAgY3JlYXRlX3N0cmlwZWRfdm9sdW1lICIke0RJU0tTW0BdfSIKZWxzZQogICAgc2Nhbl9wYXJ0aXRpb25fZm9ybWF0CmZpCg=="
 }
 PROTECTED_SETTINGS
 
 depends_on = [
   azurerm_virtual_machine_data_disk_attachment.atch
 ]
}
No Comments

Sorry, the comment form is closed at this time.