Forum Discussion
Error: spawn C:\hostedtoolcache\windows\terraform\1.5.5\x64\terraform.exe ENOENT
2023-08-21T19:27:27.5568244Z ##[error]Error: There was an error when attempting to execute the process 'C:hostedtoolcachewindowsterraform1.5.5x64terraform.exe'. This may indicate the process failed to start. Error: spawn C:hostedtoolcachewindowsterraform1.5.5x64terraform.exe ENOENT
Azure devops pipeline fails with above error. I have renamed my artifact and then run pipeline. Path is correct only. Even if new run given or saved from github to trigger pipeline, it fails . Please help.
1 Reply
Take this:
- Terraform Not Installed or Not Found
Even if the path seems valid, the agent might not have Terraform installed at that location. If you're using a Microsoft-hosted agent, you need to explicitly install Terraform in your pipeline.
Add a TerraformInstaller task before using Terraform:
- task: TerraformInstaller@0 inputs: terraformVersion: '1.5.5'
- Incorrect Working Directory
If your pipeline references a working directory that doesn’t match the location of your Terraform files or artifacts, Terraform won’t find main.tf, and the error might misleadingly point to the executable.
Double-check the workingDirectory in your Terraform task. It should match the path where your .tf files are located:
workingDirectory: '$(System.DefaultWorkingDirectory)/_YourArtifactName/drop'
- Artifact Source Alias Mismatch
If you renamed your artifact, make sure the pipeline references the correct alias. A mismatch here can cause the pipeline to look in the wrong place.
Update the workingDirectory to reflect the new artifact name:
workingDirectory: '$(System.DefaultWorkingDirectory)/_RenamedArtifact/drop'