For this project, you will write a Packer template and a Terraform template to deploy a customizable, scalable web server in Azure.
-
Deploy a policy that ensures all indexed resources in your subscription have tags and deny deployment if they do not.
-
Create a reusable Linux image with the packer script included in the project
-
Create, update and destroy your infrastructure with the Terraform template provided
- Create an Azure Account
- Install the Azure command line interface
- Install Packer
- Install Terraform
Before you run your packer script, make sure you:
- Define your client_id, client_secret, and subscription id
- In the builders section, make sure you specify Umbuntu 18.04-LTS SKU as your base image
- Ensure the image you specify for Packer is the same specified in your Terraform template
Before you run your Terraform script, ensure the following steps have been done:
- Create a resource group
- Create a virtual network and a subnet of the virtual network
- Create a Network security group. Ensure you allow access from vms on the same network and deny access from the internet
- Create a Netwoork interface
- Create a public IP
- Create a Load Balancer. You will need to create a backend address pool and address pool association for the network interface and load balancer
- Create a Virtual Machine availability set
- Create virtual machines. make sure you use the images you deployed using packer
- create mangaged disks for your virtual machine 10.Ensure number of virtual machines in the cluster can be configured in your variables file
make sure you allow the number of virtual machines to be configurable in var.tf file to simplify deployment you can also define important variables in var.tf file like:
- Resource group name
- location
- vm size and
- vm count
At the end of this exercise, you should get result similar to the screen shot below