Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running instructions do not contain non-commercial Azure cloud support #1345

Closed
agray0232 opened this issue Sep 20, 2023 · 0 comments · Fixed by #1346
Closed

Running instructions do not contain non-commercial Azure cloud support #1345

agray0232 opened this issue Sep 20, 2023 · 0 comments · Fixed by #1346
Labels
bug Something isn't working

Comments

@agray0232
Copy link
Contributor

agray0232 commented Sep 20, 2023

Describe the bug
The azure examples do not contain instructions sufficient for running the tests in non-commercial (ie USGov) cloud environments. "AZURE_ENVIRONMENT" needs to be set as an environment variable for any non-commercial cloud test to work.

Running a simple test case for a USGov cloud deployments results in a "Subscription not found" 404 error thrown by the resource_client attempting to retrieve the test resources for evaluation.

The client_factory has documented the environment variable it uses to know what Azure cloud to use when generating resource clients.

To successfully test the deployment of resources in a non-commercial cloud environment, the "AZURE_ENVIRONMENT" environment variable needs to be set by the user.

To Reproduce

  • Set your active cloud with the Azure CLI to non-commercial: az cloud set --name AzureUSGovernment
  • Login to your azure account: az login
  • Run TestTerraformAzureExample from test/azure/terraform_azure_example_test.go
  • The test will fail with a 404 error saying your subscription was not found
  • Set the AZURE_ENVIRONMENT variable: export AZURE_ENVIRONMENT=AzureUSGovernmentCloud
  • Run TestTerraformAzureExample from test/azure/terraform_azure_example_test.go
  • The test should pass

Error Trace

    resourcegroup.go:16: 
        	Error Trace:	/Users/<user>/go/pkg/mod/github.com/gruntwork-io/terratest@v0.44.0/modules/azure/resourcegroup.go:16

        	Error:      	Received unexpected error:
        	            	resources.GroupsClient#Get: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="SubscriptionNotFound" Message="The subscription '<subscription_id>' could not be found."

Expected behavior
Tests should pass for non-commercial Azure clouds

Versions

  • Terratest version: v0.44.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant