From 3dc5f113981d1e236b401c34a6960babea997616 Mon Sep 17 00:00:00 2001 From: Anthony Gray Date: Wed, 20 Sep 2023 16:45:53 -0400 Subject: [PATCH] Updated readmes --- examples/azure/README.md | 10 ++++++++++ examples/azure/terraform-azure-example/README.md | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/examples/azure/README.md b/examples/azure/README.md index 8dbca3ec8..b13237b3e 100644 --- a/examples/azure/README.md +++ b/examples/azure/README.md @@ -37,11 +37,20 @@ go build terraform_azure_*_test.go As part of configuring terraform for Azure, we'll want to check that we have set the appropriate [credentials](https://docs.microsoft.com/azure/terraform/terraform-install-configure?toc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fterraform%2Ftoc.json&bc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fbread%2Ftoc.json#set-up-terraform-access-to-azure) and also that we set the [environment variables](https://docs.microsoft.com/azure/terraform/terraform-install-configure?toc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fterraform%2Ftoc.json&bc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fbread%2Ftoc.json#configure-terraform-environment-variables) on the testing host. +For non-commercial cloud deployments, set the "AZURE_ENVIRONMENT" environment variable to the appropriate cloud environment (this is used by the [client_factory](../../modules/azure/client_factory.go) to set the correct azure endpoints): + ```bash export ARM_CLIENT_ID=your_app_id export ARM_CLIENT_SECRET=your_password export ARM_SUBSCRIPTION_ID=your_subscription_id export ARM_TENANT_ID=your_tenant_id + +# AZURE_ENVIRONMENT is the name of the Azure environment to use. Set to one of the following: +export AZURE_ENVIRONMENT=AzureUSGovernmentCloud +export AZURE_ENVIRONMENT=AzureChinaCloud +export AZURE_ENVIRONMENT=AzureGermanCloud +export AZURE_ENVIRONMENT=AzurePublicCloud +export AZURE_ENVIRONMENT=AzureStackCloud ``` Note, in a Windows environment, these should be set as **system environment variables**. We can use a PowerShell console with administrative rights to update these environment variables: @@ -51,4 +60,5 @@ Note, in a Windows environment, these should be set as **system environment vari [System.Environment]::SetEnvironmentVariable("ARM_CLIENT_SECRET",$your_password,[System.EnvironmentVariableTarget]::Machine) [System.Environment]::SetEnvironmentVariable("ARM_SUBSCRIPTION_ID",$your_subscription_id,[System.EnvironmentVariableTarget]::Machine) [System.Environment]::SetEnvironmentVariable("ARM_TENANT_ID",$your_tenant_id,[System.EnvironmentVariableTarget]::Machine) +[System.Environment]::SetEnvironmentVariable("AZURE_ENVIRONMENT",$your_azure_env,[System.EnvironmentVariableTarget]::Machine) ``` diff --git a/examples/azure/terraform-azure-example/README.md b/examples/azure/terraform-azure-example/README.md index 44ab02056..fb0a4bbad 100644 --- a/examples/azure/terraform-azure-example/README.md +++ b/examples/azure/terraform-azure-example/README.md @@ -74,20 +74,30 @@ go build terraform_azure_example_test.go ## Review Environment Variables -As part of configuring terraform for Azure, we'll want to check that we have set the appropriate [credentials](https://docs.microsoft.com/en-us/azure/terraform/terraform-install-configure?toc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fterraform%2Ftoc.json&bc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fbread%2Ftoc.json#set-up-terraform-access-to-azure) and also that we set the [environment variables](https://docs.microsoft.com/en-us/azure/terraform/terraform-install-configure?toc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fterraform%2Ftoc.json&bc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fbread%2Ftoc.json#configure-terraform-environment-variables) on the testing host. +As part of configuring terraform for Azure, we'll want to check that we have set the appropriate [credentials](https://docs.microsoft.com/azure/terraform/terraform-install-configure?toc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fterraform%2Ftoc.json&bc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fbread%2Ftoc.json#set-up-terraform-access-to-azure) and also that we set the [environment variables](https://docs.microsoft.com/azure/terraform/terraform-install-configure?toc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fterraform%2Ftoc.json&bc=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fbread%2Ftoc.json#configure-terraform-environment-variables) on the testing host. + +For non-commercial cloud deployments, set the "AZURE_ENVIRONMENT" environment variable to the appropriate cloud environment (this is used by the [client_factory](../../modules/azure/client_factory.go) to set the correct azure endpoints): ```bash export ARM_CLIENT_ID=your_app_id export ARM_CLIENT_SECRET=your_password export ARM_SUBSCRIPTION_ID=your_subscription_id export ARM_TENANT_ID=your_tenant_id + +# AZURE_ENVIRONMENT is the name of the Azure environment to use. Set to one of the following: +export AZURE_ENVIRONMENT=AzureUSGovernmentCloud +export AZURE_ENVIRONMENT=AzureChinaCloud +export AZURE_ENVIRONMENT=AzureGermanCloud +export AZURE_ENVIRONMENT=AzurePublicCloud +export AZURE_ENVIRONMENT=AzureStackCloud ``` -Note, in a Windows environment, these should be set as **system environment variables**. We can use a PowerShell console with administrative rights to update these environment variables: +Note, in a Windows environment, these should be set as **system environment variables**. We can use a PowerShell console with administrative rights to update these environment variables: ```powershell [System.Environment]::SetEnvironmentVariable("ARM_CLIENT_ID",$your_app_id,[System.EnvironmentVariableTarget]::Machine) [System.Environment]::SetEnvironmentVariable("ARM_CLIENT_SECRET",$your_password,[System.EnvironmentVariableTarget]::Machine) [System.Environment]::SetEnvironmentVariable("ARM_SUBSCRIPTION_ID",$your_subscription_id,[System.EnvironmentVariableTarget]::Machine) [System.Environment]::SetEnvironmentVariable("ARM_TENANT_ID",$your_tenant_id,[System.EnvironmentVariableTarget]::Machine) +[System.Environment]::SetEnvironmentVariable("AZURE_ENVIRONMENT",$your_azure_env,[System.EnvironmentVariableTarget]::Machine) ```