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

     1  # Terraform Azure Action Group Example
     2  
     3  This folder contains a Terraform module that deploys an [Azure Action Group](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/action-groups) in [Azure](https://azure.microsoft.com/) to demonstrate how you can use Terratest to write automated tests for your Azure Terraform code. 
     4  
     5  Check out [test/azure/terraform_azure_actiongroup_example_test.go](/test/azure/terraform/azure_actiongroup_example_test.go) to see how you can write automated tests for this module and validate the configuration of the parameters and options. 
     6  
     7  **WARNING**: This module and the automated tests for it deploy real resources into your Azure account which can cost you money. 
     8  
     9  ## Prerequisite: Setup Azure CLI access
    10  1. Sign up for [Azure](https://azure.microsoft.com/).
    11  1. Install [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)
    12  2. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH`.
    13  3. Login to Azure on the CLI with `az login` or `az login --use-device`, and then configure the CLI.
    14  
    15  ## Running this module manually
    16  1. Create [Service Principal](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest) then set the value to the environment variables. 
    17  1. Run `terraform init`.
    18  2. Run `terraform apply`.
    19  3. Log into Azure to validate resource was created.
    20  4. When you're done, run `terraform destroy`.
    21  
    22  ### Example
    23  
    24  ```bash
    25  $ az login 
    26  $ export ARM_SUBSCRIPTION_ID={YOUR_SUBSCRIPTION_ID} 
    27  $ az ad sp create-for-rbac
    28  $ export TF_VAR_client_id={YOUR_SERVICE_PRINCIPAL_APP_ID}
    29  $ export TF_VAR_client_secret={YOUR_SERVICE_PRINCIPAL_PASSWORD}
    30  $ terraform init
    31  $ terraform apply
    32  $ terraform destroy
    33  ```
    34  
    35  ## Running automated tests against this module
    36  1. Create [Service Principal](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest) then set the value to the environment variables. 
    37  1. Install [Golang](https://golang.org/) version `1.13+` required. 
    38  1. `cd test/azure`
    39  1. `go test -v -timeout 60m -tags azure -run TestTerraformAzureActionGroupExample`
    40  
    41  
    42  ### Example
    43  
    44  ```bash
    45  $ az login 
    46  $ export ARM_SUBSCRIPTION_ID={YOUR_SUBSCRIPTION_ID} 
    47  $ export TF_VAR_client_id={YOUR_SERVICE_PRINCIPAL_APP_ID}
    48  $ export TF_VAR_client_secret={YOUR_SERVICE_PRINCIPAL_PASSWORD}
    49  $ cd test/azure
    50  $ go test -v -timeout 60m -tags azure -run TestTerraformAzureActionGroupExample
    51  ```