azureazure-devopsterraformterraform0.12+

Yaml Azure Devops TerraformInstaller is ambiguous


Here i am trying to create aks using terraform, using azure-devops to deploy the resource to azure. pipeline job has failed within a sec. below is the pipeline code.

trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

stages:
- stage: TerraformValidate
  jobs:
    - job: TerraformValidateJob
      continueOnError: false
      steps:
      - task: PublishPipelineArtifact@1
        displayName: Publish Artifacts
        inputs:
          targetPath: '$(System.DefaultWorkingDirectory)/terraform-manifests'
          artifact: 'terraform-manifests-out'
          publishLocation: 'pipeline'
      - task: TerraformInstaller@0
        displayName: Terraform Install
        inputs:
          terraformVersion: 'latest'
      - task: TerraformCLI@0
        displayName: Terraform Init
        inputs:
          command: 'init'
          workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests'
          backendType: 'azurerm'
          backendServiceArm: ''
          backendAzureRmResourceGroupName: ''
          backendAzureRmStorageAccountName: ''
          backendAzureRmContainerName: ''
          backendAzureRmKey: 'aks-base.tfstate'
          allowTelemetryCollection: false
      - task: TerraformCLI@0
        displayName: Terraform Validate
        inputs:
          command: 'validate'
          workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests'
          allowTelemetryCollection: false       

getting below error : enter image description here

I have installed both the extensions: enter image description here


Solution

  • After installing these two extensions at the same time, I can reproduce the same issue.

    enter image description here

    The root cause of the issue is that terraform install task exists in both extensions at the same time.

    enter image description here

    Their simplified version of YAML task names are all TerraformInstaller@0.

    To solve this issue, you can uninstall one of the two extensions.

    Or you can specify the full name.

    For example:

    - task: ms-devlabs.custom-terraform-tasks.custom-terraform-installer-task.TerraformInstaller@0
    

    OR

    - task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-installer.TerraformInstaller@0