Infrastructure as Code example

IoC examples using Azure

View on GitHub
Home Github basics part 1 Terraform basics part 1 Terraform Examples Github collaboration

Example: Loadbalancing

Architecture overview

In this example you will create a loadbalancer with a public IP and a backend resource pool that is connected to a virtual machine scale set that contains two linux servers running nginx

Example files

All example files can be found here:

This folder contains the following files:

Local configuration file

For this example you should have your own terraform.tfvars stored in the same folder. This file contains secrets and must not be under versioncontrol.

terraform.tfvars file should have the following content:

# local file, that is'nt under versioncontrol

# choose your own prefix, identifying your resources
app_name="****************"
# generate your own secret and secure password
linux_admin_password="****************"
#sub_id can be found using the following command: az account show
sub_id="****************"

terraform state file settings

The terraformstate.tf contains only a template for you to fill out. To find your correct settings please go to the Azure portal and find your terraform state resource.