Azure devops Azure Devops-Terraform任务失败,错误为:后端配置参数无效

Azure devops Azure Devops-Terraform任务失败,错误为:后端配置参数无效,azure-devops,terraform,azure-pipelines,Azure Devops,Terraform,Azure Pipelines,我打算在我的azure Devops管道上运行terraform。我使用的是MicrosoftDevlab从市场上购买的terraform扩展版本0.1.8 我的任务如下: task: TerraformTaskV1@0 displayName: 'Terraform - Init' inputs: provider: 'azurerm' command: 'init' commandOptions: '-input=false' backendServiceArm: 'service-conn

我打算在我的azure Devops管道上运行terraform。我使用的是MicrosoftDevlab从市场上购买的terraform扩展版本0.1.8 我的任务如下:

task: TerraformTaskV1@0
displayName: 'Terraform - Init'
inputs:
provider: 'azurerm'
command: 'init'
commandOptions: '-input=false'
backendServiceArm: 'service-connection'
backendAzureRmResourceGroupName: 'Project-RG'
backendAzureRmStorageAccountName: 'projectsa'
backendAzureRmContainerName: 'tfstate'
backendAzureRmKey: 'terraform.tfstate'
workingDirectory: terraform
它试图执行的命令是

`/opt/hostedtoolcache/terraform/0.13.5/x64/terraform init -backend-config=storage_account_name=projectsa -backend-config=container_name=tfstate -backend-config=key=terraform.tfstate -backend-config=resource_group_name=Project-RG -backend-config=arm_subscription_id=xxxx-xxxx-xxxx -backend-config=arm_tenant_id=*** -backend-config=arm_client_id=*** -backend-config=arm_client_secret=***’
错误消息是:

Initializing the backend...  
Error: Invalid backend configuration argument
The backend configuration argument "storage_account_name" given on the command line is not expected for the selected backend type.   
Error: Invalid backend configuration argument  
The backend configuration argument "container_name" given on the command line is not expected for the selected backend type.   
Error: Invalid backend configuration argument  
The backend configuration argument "key" given on the command line is not expected for the selected backend type.
这是我做的

-任务:TerraformInstaller@0
投入:
terraformVersion:'0.13.5'
-任务:TerraformTaskV1@0
投入:
提供者:“azurerm”
命令:“init”
workingDirectory:“$(System.DefaultWorkingDirectory)/stackoverflow/74 terraform”
backendServiceArm:“rg代码手册”
backendAzureRmResourceGroupName:“代码手册”
backendAzureRmStorageAccountName:“代码手册”
backendAzureRmContainerName:“infra”
backendAzureRmKey:'tfstate-so-74'
commandOptions:'-input=false'
让它工作起来

2020-12-04T10:06:25.4318809Z [command]/opt/hostedtoolcache/terraform/0.13.5/x64/terraform init -backend-config=storage_account_name=thecodemanual -backend-config=container_name=infra -backend-config=key=tfstate-so-74 -backend-config=resource_group_name=TheCodeManual -backend-config=arm_subscription_id=<subscriptionId> -backend-config=arm_tenant_id=*** -backend-config=arm_client_id=*** -backend-config=arm_client_secret=***
2020-12-04T10:06:25.4670082Z 
2020-12-04T10:06:25.4675423Z [0m[1mInitializing the backend...[0m
2020-12-04T10:06:25.4738557Z [0m[32m
2020-12-04T10:06:25.4740133Z Successfully configured the backend "azurerm"! Terraform will automatically
2020-12-04T10:06:25.4742265Z use this backend unless the backend configuration changes.[0m
2020-12-04T10:06:25.9242628Z [33m
2020-12-04T10:06:25.9244849Z [1m[33mWarning: [0m[0m[1m"arm_client_id": [DEPRECATED] `arm_client_id` has been replaced by `client_id`[0m
2020-12-04T10:06:25.9246980Z 
2020-12-04T10:06:25.9248608Z [0m[0m[0m
2020-12-04T10:06:25.9249659Z [33m
2020-12-04T10:06:25.9251909Z [1m[33mWarning: [0m[0m[1m"arm_client_secret": [DEPRECATED] `arm_client_secret` has been replaced by `client_secret`[0m
2020-12-04T10:06:25.9252897Z 
2020-12-04T10:06:25.9254321Z [0m[0m[0m
2020-12-04T10:06:25.9255028Z [33m
2020-12-04T10:06:25.9256913Z [1m[33mWarning: [0m[0m[1m"arm_tenant_id": [DEPRECATED] `arm_tenant_id` has been replaced by `tenant_id`[0m
2020-12-04T10:06:25.9261480Z 
2020-12-04T10:06:25.9262574Z [0m[0m[0m
2020-12-04T10:06:25.9263605Z [33m
2020-12-04T10:06:25.9264816Z [1m[33mWarning: [0m[0m[1m"arm_subscription_id": [DEPRECATED] `arm_subscription_id` has been replaced by `subscription_id`[0m
2020-12-04T10:06:25.9265629Z 
2020-12-04T10:06:25.4318809Z[命令]/opt/hostedtoolcache/terraform/0.13.5/x64/terraform init-backend config=storage\u account\u name=thecodemanu-backend config=container\u name=infra-backend config=key=tfstate-so-74-backend config=resource\u group\u name=thecodemanu-backend config=arm\u subscription\u id=-backend config=arm\u-tenant\u id=***-backend config=arm\u-client\u-id=***-后端配置=arm\u客户端\u机密=***
2020-12-04T10:06:25.4670082Z
2020-12-04T10:06:25.4675423Z[0m[1m初始化后端…[0m]
2020-12-04T10:06:25.4738557Z[0m[32m
2020-12-04T10:06:25.4740133Z成功配置后端“azurerm”!Terraform将自动
2020-12-04T10:06:25.4742265Z除非后端配置发生更改,否则请使用此后端。[0m
2020-12-04T10:06:25.9242628Z[33米
2020-12-04T10:06:25.9244849Z[1m[33M警告:[0m[0m[1m“arm\U客户端id”:[不推荐]“arm\U客户端id”已被“客户端id”替换为[0m
2020-12-04T10:06:25.9246980Z
2020-12-04T10:06:25.9248608Z[0m[0m]
2020-12-04T10:06:25.9249659Z[33米
2020-12-04T10:06:25.9251909Z[1m[33M警告:[0m[0m[1m”arm_客户_机密]:[弃用]“arm_客户_机密”已替换为“客户_机密”[0m
2020-12-04T10:06:25.9252897Z
2020-12-04T10:06:25.9254321Z[0m[0m]
2020-12-04T10:06:25.9255028Z[33米
2020-12-04T10:06:25.9256913Z[1m[33M警告:[0m[0m[1m“arm\U租户id”:[已弃用]“arm\U租户id”已替换为“租户id”[0m
2020-12-04T10:06:25.9261480Z
2020-12-04T10:06:25.9262574Z[0m[0m]
2020-12-04T10:06:25.9263605Z[33米
2020-12-04T10:06:25.9264816Z[1m[33M警告:[0m[0m[1m“arm\U订阅id”:[不推荐]“arm\U订阅id”已替换为“订阅id”[0m
2020-12-04T10:06:25.9265629Z
关于设置的弃用信息,但目前这不会导致失败。为此,github上已经有了和PR

TerraformTaskV1
之前,您是否运行了
TerraformInstaller

我运行了这个

-任务:TerraformInstaller@0
投入:
terraformVersion:'0.13.5'
-任务:TerraformTaskV1@0
投入:
提供者:“azurerm”
命令:“init”
workingDirectory:“$(System.DefaultWorkingDirectory)/stackoverflow/74 terraform”
backendServiceArm:“rg代码手册”
backendAzureRmResourceGroupName:“代码手册”
backendAzureRmStorageAccountName:“代码手册”
backendAzureRmContainerName:“infra”
backendAzureRmKey:'tfstate-so-74'
commandOptions:'-input=false'
让它工作起来

2020-12-04T10:06:25.4318809Z [command]/opt/hostedtoolcache/terraform/0.13.5/x64/terraform init -backend-config=storage_account_name=thecodemanual -backend-config=container_name=infra -backend-config=key=tfstate-so-74 -backend-config=resource_group_name=TheCodeManual -backend-config=arm_subscription_id=<subscriptionId> -backend-config=arm_tenant_id=*** -backend-config=arm_client_id=*** -backend-config=arm_client_secret=***
2020-12-04T10:06:25.4670082Z 
2020-12-04T10:06:25.4675423Z [0m[1mInitializing the backend...[0m
2020-12-04T10:06:25.4738557Z [0m[32m
2020-12-04T10:06:25.4740133Z Successfully configured the backend "azurerm"! Terraform will automatically
2020-12-04T10:06:25.4742265Z use this backend unless the backend configuration changes.[0m
2020-12-04T10:06:25.9242628Z [33m
2020-12-04T10:06:25.9244849Z [1m[33mWarning: [0m[0m[1m"arm_client_id": [DEPRECATED] `arm_client_id` has been replaced by `client_id`[0m
2020-12-04T10:06:25.9246980Z 
2020-12-04T10:06:25.9248608Z [0m[0m[0m
2020-12-04T10:06:25.9249659Z [33m
2020-12-04T10:06:25.9251909Z [1m[33mWarning: [0m[0m[1m"arm_client_secret": [DEPRECATED] `arm_client_secret` has been replaced by `client_secret`[0m
2020-12-04T10:06:25.9252897Z 
2020-12-04T10:06:25.9254321Z [0m[0m[0m
2020-12-04T10:06:25.9255028Z [33m
2020-12-04T10:06:25.9256913Z [1m[33mWarning: [0m[0m[1m"arm_tenant_id": [DEPRECATED] `arm_tenant_id` has been replaced by `tenant_id`[0m
2020-12-04T10:06:25.9261480Z 
2020-12-04T10:06:25.9262574Z [0m[0m[0m
2020-12-04T10:06:25.9263605Z [33m
2020-12-04T10:06:25.9264816Z [1m[33mWarning: [0m[0m[1m"arm_subscription_id": [DEPRECATED] `arm_subscription_id` has been replaced by `subscription_id`[0m
2020-12-04T10:06:25.9265629Z 
2020-12-04T10:06:25.4318809Z[命令]/opt/hostedtoolcache/terraform/0.13.5/x64/terraform init-backend config=storage\u account\u name=thecodemanu-backend config=container\u name=infra-backend config=key=tfstate-so-74-backend config=resource\u group\u name=thecodemanu-backend-config=arm\u subscription\u id=-backend-config=arm\u-tenant\u-id=***-backend-config=arm=arm\u客户端\u机密=***
2020-12-04T10:06:25.4670082Z
2020-12-04T10:06:25.4675423Z[0m[1m初始化后端…[0m]
2020-12-04T10:06:25.4738557Z[0m[32m
2020-12-04T10:06:25.4740133Z成功配置后端“azurerm”!Terraform将自动
2020-12-04T10:06:25.4742265Z除非后端配置发生更改,否则请使用此后端。[0m
2020-12-04T10:06:25.9242628Z[33米
2020-12-04T10:06:25.9244849Z[1m[33M警告:[0m[0m[1m“arm\U客户端id”:[不推荐]“arm\U客户端id”已被“客户端id”替换为[0m
2020-12-04T10:06:25.9246980Z
2020-12-04T10:06:25.9248608Z[0m[0m]
2020-12-04T10:06:25.9249659Z[33米
2020-12-04T10:06:25.9251909Z[1m[33M警告:[0m[0m[1m”arm_客户_机密]:[弃用]“arm_客户_机密”已替换为“客户_机密”[0m
2020-12-04T10:06:25.9252897Z
2020-12-04T10:06:25.9254321Z[0m[0m]
2020-12-04T10:06:25.9255028Z[33米
2020-12-04T10:06:25.9256913Z[1m[33M警告:[0m[0m[1m“arm\U租户id”:[已弃用]“arm\U租户id”已替换为“租户id”[0m
2020-12-04T10:06:25.9261480Z
2020-12-04T10:06:25.9262574Z[0m[0m]
2020-12-04T10:06:25.9263605Z[33米
2020-12-04T10:06:25.9264816Z[1m[33M警告:[0m[0m[1m“arm\U订阅id”:[不推荐]“arm\U订阅id”已替换为“订阅id”[0m
2020-12-04T10:06:25.9265629Z
关于设置的弃用信息,但目前这不会导致失败。为此,github上已经有了和PR


您是否在
TerraformTaskV1
之前运行了
TerraformInstaller

修复了它。解决方案有点尴尬。有人提到.tf文件后端是本地的。这是有道理的,因为本地后端不支持这些参数。将后端更改为azure修复了它。请确保将正确的后端定义为该错误确实表明后端的参数不受支持。

修复了它。解决方案有点尴尬。将.tf文件后端提到为本地。这现在是有意义的,因为本地后端不支持这些参数。将后端更改为azure修复了它。确保按照错误定义了正确的后端假设后端的参数不受支持。

能否粘贴e