0
votes

Created a simple Azure devops release pipeline to provision a resource group. Tested terraform script with remote state file locally and checked in the code to git. This is how the code is organized: IAC (root folder) /bin/terraform.exe main.tf (this has terraform configuration with remote state)

Created a release pipeline pointing to this repository as code. Pipleline gives the alias _IAC to the artifact

in the pipeline I have powershell activities to login to azure using a service principal

then the following line:

$(System.DefaultWorkingDirectory)/_IAC/bin/terraform init

This command executes but says there is no terraform configuration file.

2020-03-05T02:23:04.4536130Z [0m[1mTerraform initialized in an empty directory![0m
2020-03-05T02:23:04.4536786Z 
2020-03-05T02:23:04.4556953Z The directory has no Terraform configuration files. You may begin working
2020-03-05T02:23:04.4559693Z with Terraform immediately by creating Terraform configuration files.[0m
1

1 Answers

0
votes

the working directory where azure release pipeline agent is running did not have the configuration file. I had to use a copy operation to copy the main.tf file to the $(AgentWorkingDirectory)