具有 Terraform 的 Azure DevOps Pipelines 在 arm_xxx 参数上失败

Har*_*euf 6 terraform-provider-azure azure-devops-pipelines

我们在 Azure-Devops 中有多个管道执行 Terraform init-plan-apply。到目前为止,工作正常。\n但是突然间,我们在 Init 阶段遇到了这些错误。

\n
Initializing the backend...\n\xe2\x95\xb7\n\xe2\x94\x82 Error: Invalid backend configuration argument\n\xe2\x94\x82 \n\xe2\x94\x82 The backend configuration argument "arm_subscription_id" given on the command line is not expected for the selected backend type.\n\xe2\x95\xb5 Error: Invalid backend configuration argument\n\xe2\x94\x82 \n\xe2\x94\x82 The backend configuration argument "arm_tenant_id" .....\n\xe2\x94\x82 The backend configuration argument "arm_client_id" .....\n\xe2\x94\x82 The backend configuration argument "arm_client_secret" ....\n
Run Code Online (Sandbox Code Playgroud)\n

在hasicorp网站上我发现了一个关于这个https://www.terraform.io/upgrade-guides/0-15.html的评论。\n但是init命令的生成完全是由DevOps完成的,没有地方我可以将arm_client_id更改为client_id(以及其他)。

\n

任何人都见过这种行为并能够解决它。

\n

Sam*_*ams 3

今天我在这个问题上花了大约2个小时,我发现我必须执行以下操作。

  1. 我必须安装 Terraform 0.14.11,因为新的 0.15.1 失败

  2. 在 Terraform init 任务中,将-reconfigure添加到其他命令参数

  3. 尽管我的 terraform 代码在我的 PC 上运行良好,但我遇到了与您相同的错误。在我的main.tf文件中,我删除了对后端的所有引用,因为它们已在 init 任务中定义

    terraform {
      required_providers {
        azurerm = {
          source  = "hashicorp/azurerm"
          version = "=2.48.0"
        }
      }
    }
    
    provider "azurerm" {
      features {}
    }
    
    terraform {
      backend "azurerm" {
      }
    }
Run Code Online (Sandbox Code Playgroud)