github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/azure/terraform-azure-nsg-example/README.md (about)

     1  # Terraform Azure NSG Example
     2  
     3  This folder contains a simple Terraform module that deploys resources in [Azure](https://azure.microsoft.com/) to demonstrate how you can use Terratest to write automated tests for your Azure Terraform code. This module deploys the following:
     4  
     5  * A [Virtual Machine](https://azure.microsoft.com/en-us/services/virtual-machines/) that gives the module the following:
     6      * [Virtual Machine](https://docs.microsoft.com/en-us/azure/virtual-machines/) with the value specified in the `vm_name` variable along with a random value for the `postfix` variable (set from test code).
     7      * A [Network Security Group](https://docs.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview) created with a single custom rule to allow SSH (port 22) with the nsg name specified in the `nsg_name` variable along with a random value for the `postfix` variable (set from test code).
     8  
     9  Check out [test/azure/terraform_azure_nsg_example_test.go](/test/azure/terraform_azure_nsg_example_test.go) to see how you can write
    10  automated tests for this module.
    11  
    12  Note that the resources deployed in this module don't actually do anything; it just runs the resources for
    13  demonstration purposes.
    14  
    15  **WARNING**: This module and the automated tests for it deploy real resources into your Azure account which can cost you
    16  money. The resources are all part of the [Azure Free Account](https://azure.microsoft.com/en-us/free/), so if you haven't used that up,
    17  it should be free, but you are completely responsible for all Azure charges.
    18  
    19  ## Running this module manually
    20  
    21  1. Sign up for [Azure](https://azure.microsoft.com/)
    22  1. Configure your Azure credentials using one of the [supported methods for Azure CLI
    23     tools](https://docs.microsoft.com/en-us/cli/azure/azure-cli-configuration?view=azure-cli-latest)
    24  1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH`
    25  1. Ensure [environment variables](../README.md#review-environment-variables) are available
    26  1. Run `terraform init`
    27  1. Run `terraform apply`
    28  1. When you're done, run `terraform destroy`
    29  
    30  ## Running automated tests against this module
    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/en-us/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. Configure your Terratest [Go test environment](../README.md)
    37  1. `cd test/azure`
    38  1. `go build terraform_azure_nsg_example_test.go`
    39  1. `go test -v -run TestTerraformAzureNsgExample`