github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/azure/terraform-azure-vm-example/README.md (about) 1 # Terraform Azure Virtual Machine Example 2 3 This folder contains a complete Terraform VM 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 Virtual Machine Terraform code. This module deploys these resources: 5 6 - A [Virtual Machine](https://azure.microsoft.com/services/virtual-machines/) and gives that VM the following resources: 7 - [Virtual Machine](https://docs.microsoft.com/azure/virtual-machines/) with the name specified in the `vm_name` variable. 8 - [Managed Disk](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview) with the name specified in the `managed_disk_name` variable. 9 - [Availability Set](https://docs.microsoft.com/azure/virtual-machines/availability) with the name specified in the `availability_set_name` variable. 10 - A [Virtual Network](https://azure.microsoft.com/services/virtual-network/) module that contains the following resources: 11 - [Virtual Network](https://docs.microsoft.com/azure/virtual-network/) with the name specified in the `virtual_network_name` variable. 12 - [Subnet](https://docs.microsoft.com/rest/api/virtualnetwork/subnets) with the name specified in the `subnet_name` variable. 13 - [Public Address](https://docs.microsoft.com/azure/virtual-network/public-ip-addresses) with the name specified in the `public_ip_name` variable. 14 - [Network Interface](https://docs.microsoft.com/azure/virtual-network/virtual-network-network-interface) with the name specified in the `network_interface_name` variable. 15 16 Check out [test/azure/terraform_azure_vm_test.go](/test/azure/terraform_azure_vm_test.go) to see how you can write 17 automated tests for this module. 18 19 Note that the Virtual Machine module creates a Microsoft Windows Server Image with a managed disk, availability set and network configuration for demonstration purposes. 20 21 **WARNING**: This module and the automated tests for it deploy real resources into your Azure account which can cost you 22 money. The resources are all part of the [Azure Free Account](https://azure.microsoft.com/free/), so if you haven't used that up, 23 it should be free, but you are completely responsible for all Azure charges. 24 25 ## Running this module manually 26 27 1. Sign up for [Azure](https://azure.microsoft.com/) 28 1. Configure your Azure credentials using one of the [supported methods for Azure CL 29 tools](https://docs.microsoft.com/cli/azure/azure-cli-configuration?view=azure-cli-latest) 30 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH` 31 1. Ensure [environment variables](../README.md#review-environment-variables) are available 32 1. Run `terraform init` 33 1. Run `terraform apply` 34 1. When you're done, run `terraform destroy` 35 36 ## Running automated tests against this module 37 38 1. Sign up for [Azure](https://azure.microsoft.com/) 39 1. Configure your Azure credentials using one of the [supported methods for Azure CLI 40 tools](https://docs.microsoft.com/cli/azure/azure-cli-configuration?view=azure-cli-latest) 41 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH` 42 1. Configure your Terratest [Go test environment](../README.md) 43 1. `cd test/azure` 44 1. `go build terraform_azure_vm_test.go` 45 1. `go test -run -v -timeout 20m TestTerraformAzureVmExample`