Plan complaining about Login

Hello,

I’m getting this error, but when looking on the web I can’t realy find much doc nor tips on it.

Starting: terraform plan
==============================================================================
Task         : Terraform CLI
Description  : Execute terraform cli commands
Version      : 0.6.21
Author       : Charles Zipp
Help         : 
==============================================================================
/usr/local/bin/terraform version
Terraform v0.15.0
on linux_amd64
+ provider registry.terraform.io/hashicorp/azurerm v2.57.0

Your version of Terraform is out of date! The latest version
is 0.15.1. You can update by downloading from https://www.terraform.io/downloads.html

/usr/local/bin/terraform plan -var-file=/home/vsts/work/1/s/DAS_InfraAsCode/it-poc-int-01/_config/rg.tfvars -out=tfplan -input=false
╷
│ Error: Error building AzureRM Client: obtain subscription() from Azure CLI: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1: ERROR: Please run 'az login' to setup account.
│ 
│   on providers.tf line 1, in provider "azurerm":
│    1: provider "azurerm" {
│ 
╵

##[error]Terraform command 'plan' failed with exit code '1'.
##[error]╷
│ Error: Error building AzureRM Client: obtain subscription() from Azure CLI: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1: ERROR: Please run 'az login' to setup account.
│ 
│   on providers.tf line 1, in provider "azurerm":
│    1: provider "azurerm" {
│ 
╵

Finishing: terraform plan

Hi there,

Did you ever fix this issue? Like you, I’m having the same problem with no resolution, it was working fine one day then the next I started seeing: │ Error: Error building AzureRM Client: obtain subscription() from Azure CLI: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1

I’ve tried reinstalling Az CLI, Terraform but no fix so far, interestingly I’m able to build resources using az commands independently too, so really not sure what I’m missing.

Thanks,
Jake

No, I never could solve it. I was doing quite some special stuff with pipeline variables (From DevOps), once I took that out it started to work.
Think there is a different moment in time that the variables are interpreted between a bash command (where I checked the values) and the AZ CLI. Not only path was dynamic, my TFVars file itself was also build with variales …
Was that the reason, never could find out …
Sorry

1 Like

Even I am facing the same issue.
I have 2 Azure DevOps pipelines that are using the same variable group, steps, and tasks. Surprisingly 1st pipeline runs successfully but the second pipeline fails at PLAN phase with the same error. It’s unpredictable…!