Introduction
Github pipelines are configured to test Terraform modules via terraform test
command. The pipeline also authenticates to Azure and this step fails intermittently with the following error message:
[ERROR] provider.terraform-provider-azurerm_v4.29.0_x5: Response contains error diagnostic: diagnostic_detail="" diagnostic_summary="unable to build authorizer for Resource Manager API: could not configure AzureCli Authorizer: tenant ID was not specified and the default tenant ID could not be determined: obtaining tenant ID: obtaining account details: running Azure CLI: exit status 1: ERROR: Please run 'az login' to setup account."
Expected Outcome
The expectation would be that the pipeline be successful at every single run.
Prerequisites
- Github Actions
- Terraform provider AzureRM
Use Case
The authentication to Azure is done via static credentials stored on Github as environment secrets and the subscription ID and tenant ID are being assigned via the Github Actions pipeline.
Procedure
In the Github Actions pipeline yml
file setup max-parallel:1
when running the subsequent jobs to have terraform test
run the files one by one, similar to the following example:
jobs: example_matrix: strategy: max-parallel: 1 # Ensures tests run one by one
The error unable to build authorizer for Resource Manager API: could not configure AzureCli Authorizer: tenant ID was not specified and the default tenant ID could not be determined
shouldn't appear anymore.