Open mrybson opened 8 months ago
I had a similar problem locally. The same error occurred when the terraform
command was not available in the terminal. Make sure that Terraform is installed and the path to the directory where the Terraform executable exists is in the PATH environment variable. Try running the terraform --version
command via the workflow to verify it
Check this out for more information
https://github.com/gruntwork-io/terratest/releases/tag/v0.46.0
Describe the bug I am trying to run the terratests from Github Actions. It works fine locally, but I am getting below error when running from the GH Runner.
To Reproduce
Expected behavior Tests are getting executed.
Terminal output
[Integration Tests/go-tests] ⭐ Run Main Run Tests [Integration Tests/go-tests] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4] user= workdir=terraform/tests | === RUN MyTestFunction1 | === PAUSE MyTestFunction1 | === CONT MyTestFunction1 | myTest.go:31: mLaAA7 | MyTestFunction1 2024-01-25T16:54:12Z retry.go:91: tofu [init -upgrade=false] | MyTestFunction1 2024-01-25T16:54:12Z logger.go:66: Running command tofu with args [init -upgrade=false] | MyTestFunction1 2024-01-25T16:54:12Z retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exec: "tofu": executable file not found in $PATH; } | apply.go:15: | Error Trace: /root/go/pkg/mod/github.com/gruntwork-io/terratest@v0.46.11/modules/terraform/apply.go:15 | /mnt/c/repos/terraform-templates-deployment/terraform/tests/myTest.go:48 | Error: Received unexpected error: | FatalError{Underlying: error while running command: exec: "tofu": executable file not found in $PATH; } | Test: MyTestFunction1 | MyTestFunction1 2024-01-25T16:54:12Z retry.go:91: tofu [destroy -auto-approve -input=false -var postfix=mlaaa7 -lock=false] | MyTestFunction1 2024-01-25T16:54:12Z logger.go:66: Running command tofu with args [destroy -auto-approve -input=false -var postfix=mlaaa7 -lock=false] | MyTestFunction1 2024-01-25T16:54:12Z retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exec: "tofu": executable file not found in $PATH; } | destroy.go:11: | Error Trace: /root/go/pkg/mod/github.com/gruntwork-io/terratest@v0.46.11/modules/terraform/destroy.go:11 | /opt/hostedtoolcache/go/1.21.6/x64/src/runtime/panic.go:523 | /opt/hostedtoolcache/go/1.21.6/x64/src/testing/testing.go:999 | /root/go/pkg/mod/github.com/gruntwork-io/terratest@v0.46.11/modules/terraform/apply.go:15 | /mnt/c/repos/terraform-templates-deployment/terraform/tests/myTest.go:48 | Error: Received unexpected error: | FatalError{Underlying: error while running command: exec: "tofu": executable file not found in $PATH; } | Test: MyTestFunction1 | --- FAIL: MyTestFunction1 (0.00s) | FAIL | exit status 1
Versions
Additional I don't want to use tofu. I want to use terraform. I tried installing terraform as part of the Github action workflow, but that does not make any difference.