Search code examples
azure-devopsdeploymentterraformterraform-provider-azure

Terraform Initialize Error on Azure Devops release pipeline


I am trying to setup the release pipeline on azure DevOps with terraform configuration to create resource on Azure cloud. I have already created the main.tf and resources but while initializing the terraform thru tasks, it gives me the following error. somehow, i guess it is not able to identify the terraform.exe installed from terraform installer (previous task).

I can see that terraform installer is successfully able to install the given version of terraform, but the Initialize task is not able to locate it.

Error Screenshot at terraform initalize taskenter image description here

enter image description here

Above are the logs of terraform installer. Please help to resolve it. Thanks in advance.


Solution

  • The Terraform tool installer task indicates it has successfully installed the terraform, so the Initialize task is able to find it actually.

    I can reproduce the same error when the directory is not specified correctly in Initialize task:

    enter image description here

    You have two artifacts download, make sure directory is correct so that it's able to find the tf files.

    enter image description here

    The pipeline succeeds then:

    enter image description here

    Please check similar ticket for your reference.