6

We have several pipelines in Azure-Devops performing Terraform init-plan-apply. Until now worked fine. But all of a sudden we are getting these errors in the Init phase.

Initializing the backend...
╷
│ Error: Invalid backend configuration argument
│ 
│ The backend configuration argument "arm_subscription_id" given on the command line is not expected for the selected backend type.
╵ Error: Invalid backend configuration argument
│ 
│ The backend configuration argument "arm_tenant_id" .....
│ The backend configuration argument "arm_client_id" .....
│ The backend configuration argument "arm_client_secret" ....

On the hasicorp website I found a remark on this https://www.terraform.io/upgrade-guides/0-15.html . But thegeneration of the init command is completelly done by DevOps, there is no place where I can change the arm_client_id to client_id (and the others).

Anybody has seen this behaviour and being able to solve it.

Harry Leboeuf
  • 723
  • 12
  • 30

1 Answers1

3

I spent about 2 hours on this issue today and I found that I had to perform the following.

  1. I had to install Terraform 0.14.11 as the new 0.15.1 was failing

  2. In your Terraform init task, add -reconfigure to Additional command arguments

  3. Although my terraform code worked fine on my PC, I was getting the same errors as you are. In my main.tf file, I removed all reference to my backend since they are already defined in the init task

    terraform {
      required_providers {
        azurerm = {
          source  = "hashicorp/azurerm"
          version = "=2.48.0"
        }
      }
    }
    
    provider "azurerm" {
      features {}
    }
    
    terraform {
      backend "azurerm" {
      }
    }
Sams
  • 46
  • 2
  • can you provide an example of your init task? – garthoid May 11 '21 at 14:45
  • I added -reconfigure to my init task and it is still throwing the same error. I upgraded to terraform 0.15.3. – Anthony Klotz May 14 '21 at 21:27
  • 1
    @AnthonyKlotz - You, like I, are probably using the microsoft provider for terraform and not the one by Charles Zipp. This link, post 4, shows a bug report that is still being worked on for this issue. https://discuss.hashicorp.com/t/azure-devops-init-going-wrong/23529 – JasonS May 17 '21 at 13:17