Open mgvinuesa opened 1 year ago
I have the same issue. My workaround was az login with the service principal upfront the terraform run
az login --service-principal -u $(ARM_CLIENT_ID) -p $(ARM_CLIENT_SECRET) --tenant $(ARM_TENANT_ID)
terraform apply -auto-approve
Also experiencing this issue
I see a similar but probably related issue. I'm running a GitHub workflow using Azure Workload Identity to authenticate with Azure. The Azure Login step succeeds earlier in the workflow. This fails while it succeeded with version 0.7.2
of this provider.
Group 0: FAILED
https://***redacted***.vault.azure.net/keys/sops-key/***redacted***: FAILED
- | failed to decrypt sops data key with Azure Key Vault key
| 'https://***redacted***.vault.azure.net/keys/sops-key/***redacted***':
| DefaultAzureCredential authentication failed
| GET http://169.254.169.254/metadata/identity/oauth2/token
| --------------------------------------------------------------------------------
| RESPONSE 400 Bad Request
| --------------------------------------------------------------------------------
| ***
| "error": "invalid_request",
| "error_description": "Identity not found"
| ***
| --------------------------------------------------------------------------------
Hello,
I have a very strange error using sops provider in my terraform pipelines. While the terraform itself can retrieve the values the Key needed for work with the file, the SOPS provider can't, giving me the following error
It is important to note that adding this in my terraform file:
it works properly, retrieving the key id. If I put terraform in DEBUG I only can see the following line:
2023-04-24T10:29:04.931Z [DEBUG] provider.terraform-provider-sops_v0.7.2: [AZKV] time="2023-04-24T10:29:04Z" level=error msg="Failed to create Azure authorizer" error="Invoking Azure CLI failed with the following error: ERROR: Please run 'az login' to setup account.\n"
But the loging using the service principal has been done, if not, the terraform output would not work. Im using the following versions:
Terraform version: 1.4.5 SOPS: 0.7.2 Azurerm: v3.53.0
Obviously the process in my local machine works with any problem. So there is something (configuration...) that SOPS needs in the agent pool to work properly.
Important to say that I pass the needed env variables to the script, I don't do
az login
explicitly.Any idea?