Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform with azure CLI - error building account

using the provider block

provider "azurerm" {
  subscription_id = var.subscription_id
  version         = "=1.44"
}

and after successfully logging in with

az login

running

terraform plan

I get the following error:

Error: Error building account: Error getting authenticated object ID: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 2

on main.tf line 21, in provider "azurerm":
21: provider "azurerm" {

UPDATE:

If I change the provider block to:

provider "azurerm" {
 version = "~> 1.43"
}

and set the environment variables

ARM_USE_MSI=true
ARM_SUBSCRIPTION_ID=<...>
ARM_TENANT_ID=<...>
HTTP_PROXY=<...>
HTTPS_PROXY=<...>
http_proxy=<...>
https_proxy=<...>

than after executing terraform plan I get the following error:

Connection to 169.254.169.254 failed. No route to host.

which is very strange, as it seems to me, that a service endpoints IP is "hardcoded" into the terraform client.

like image 762
bayerb Avatar asked Feb 19 '20 08:02

bayerb


1 Answers

Even though I was already logged in via az cli, forcing another:

az login

Resolved this for me.

like image 89
Jamie D Avatar answered Oct 03 '22 20:10

Jamie D