github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/azure/terraform-azure-loadbalancer-example/README.md (about) 1 # Terraform Load Balancer Example 2 3 This folder contains a simple Terraform module that deploys resources in [Azure](https://azure.microsoft.com/) to demonstrate 4 how you can use Terratest to write automated tests for your Azure Terraform code. This module deploys two Load Balancers for Public and Private IP scenarios. 5 6 - A Public [Load Balancer](https://docs.microsoft.com/azure/load-balancer/) that gives the module the following: 7 8 - `Load Balancer` with the name specified in the `lb_public_name` and configuration in the `lb_public_fe_config_name` output variables. 9 10 - A Private [Load Balancer](https://docs.microsoft.com/azure/load-balancer/) that gives the module the following: 11 12 - `Load Balancer` with the name specified in the `lb_private_name` and static Frontend IP Configuration in the `lb_private_fe_config_static_name` output variables. 13 14 - A Default [Load Balancer](https://docs.microsoft.com/azure/load-balancer/) that gives the module the following: 15 16 - `Load Balancer` with the name specified in the `lb_default_name` and no Frontend configuration. 17 18 - Networking that provides the following for the Load Balancer module with the following: 19 - [Virtual Network](https://docs.microsoft.com/azure/virtual-network/) with the name specified in the `vnet_name` output variable. 20 - [Subnet](https://docs.microsoft.com/azure/virtual-network/virtual-network-manage-subnet) with the name specified in the `subnet_name` output variable. 21 - [Public IP Address](https://docs.microsoft.com/azure/virtual-network/virtual-network-public-ip-address) with the name specified in the `public_address_name` output variable. 22 23 Check out [test/azure/terraform_azure_loadbalancer_example_test.go](/test/azure/terraform_azure_loadbalancer_example_test.go) to see how you can write 24 automated tests for this module. 25 26 Note that the Load Balancers and their associated resources in this module don't actually do anything; they are created before running the tests, for demonstration purposes. 27 28 **WARNING**: This module and the automated tests for it deploy real resources into your Azure account which can cost you money. The resources are all part of the [Azure Free Account](https://azure.microsoft.com/free/), so if you haven't used that up, it should be free, but you are completely responsible for all Azure charges. 29 30 ## Running this module manually 31 32 1. Sign up for [Azure](https://azure.microsoft.com/) 33 1. Configure your Azure credentials using one of the [supported methods for Azure CLI 34 tools](https://docs.microsoft.com/cli/azure/azure-cli-configuration?view=azure-cli-latest) 35 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH` 36 1. Ensure [environment variables](../README.md#review-environment-variables) are available 37 1. Run `terraform init` 38 1. Run `terraform apply` 39 1. When you're done, run `terraform destroy` 40 41 ## Running automated tests against this module 42 43 1. Sign up for [Azure](https://azure.microsoft.com/) 44 1. Configure your Azure credentials using one of the [supported methods for Azure CLI 45 tools](https://docs.microsoft.com/cli/azure/azure-cli-configuration?view=azure-cli-latest) 46 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH` 47 1. Configure your Terratest [Go test environment](../README.md) 48 1. `cd test/azure` 49 1. `go build terraform_azure_loadbalancer_example_test.go` 50 1. `go test -v -run TestTerraformAzureLoadBalancerExample`