azure-pipelines-tasks-terraform
azure-pipelines-tasks-terraform copied to clipboard
Ugly error when no tf files exist
Just got this error yesterday when runnning the TerraformCLI task (init):
##[error]Error: There was an error when attempting to execute the process '/opt/hostedtoolcache/terraform/1.1.5/x64/terraform'. This may indicate the process failed to start. Error: spawn /opt/hostedtoolcache/terraform/1.1.5/x64/terraform ENOENT
without any changes to my yaml pipelines. The Terraform Installer completes successfully:
Archive: /home/vsts/work/_temp/terraform-1.1.5-a0b29100-d8ec-439c-9d20-a33fb97e663e.zip
inflating: terraform
Extracted terraform to dir: /home/vsts/work/_temp/4e75bf9f-c154-40d3-a439-56368994a093
Caching tool: terraform 1.1.5 x64
Terraform installed in path: /opt/hostedtoolcache/terraform/1.1.5/x64
Resolving path to Terraform tool...
Expected Terraform path: /opt/hostedtoolcache/terraform/1.1.5/x64/terraform
Searching the following paths: [ '/opt/hostedtoolcache/terraform/1.1.5/x64',
'/opt/hostedtoolcache/terraform/1.1.5/x64/terraform' ]
Matched files: [ '/opt/hostedtoolcache/terraform/1.1.5/x64/terraform' ]
Prepending PATH environment variable with directory: /opt/hostedtoolcache/terraform/1.1.5/x64
Verifying Terraform installation. Executing 'terraform version'
/opt/hostedtoolcache/terraform/1.1.5/x64/terraform version
Terraform v1.1.5
on linux_amd64
Pool: Azure Pipelines Image: ubuntu-latest Agent: Hosted Agent
Agent name: 'Hosted Agent' Agent machine name: 'fv-az98-615' Current agent version: '2.198.3' Operating System Virtual Environment Virtual Environment Provisioner Current image version: '20220207.1' Agent running as: 'vsts' Prepare build directory. Set build variables. Download all required tasks. Downloading task: TerraformInstaller (0.7.6) Downloading task: TerraformCLI (0.7.6) Checking job knob settings. Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} Finished checking job knob settings. Start tracking orphan processes.
There were some sitewide issues with Azure Pipelines this week. Im wondering if something changed on their end.
Same issue here. Did you figure out a solution?
I had a similar issue my problem was that I was trying to install and use TerraformCLI init in $(Build.ArtifactStagingDirectory). When I change the directory for the raw files instead it start working.
Cheers.
Every time that I got that error was because I was pointing the init/apply to a non-existing directory.
@schxa @davoodharun Did the suggestions resolve or is there still an issue?
I am able to reproduce: this happens when there is no terraform files present for the CLI task. We should fail more gracefully here.