atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

Cannot find terraform.exe when running locally on Windows 10/11

Open usoliveira opened this issue 3 years ago • 4 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

When trying to run Atlantis (v0.19.8 or earlier) using Windows binaries and running it locally, even checking terraform binary is at Windows path, it gives an error saying it cannot find terraform.exe

Reproduction Steps

  1. Download Ngrok and Atlantis;
  2. Run Ngrok;
  3. Run Atlantis passing Ngrok URL and Github credentials;
  4. Configured repo webhook;
  5. Create a pull request (running atlantis plan)

Logs

Atlantis log

{
    "level": "error",
    "ts": "2022-09-05T10:42:35.501-0300",
    "caller": "events/instrumented_project_command_runner.go:43",
    "msg": "Error running plan operation: running \"C:\\\\tools\\\\terraform.exe init -input=false -upgrade\" in \"C:\\\\Users\\\\xxxx\\\\.atlantis\\\\repos\\\\xxxxx\\\\atlantis\\\\1\\\\default\": exit status 127\n/usr/bin/bash: C:toolsterraform.exe: command not found\n",
    "json": {
        "repo": "xxxx/atlantis",
        "pull": "1"
    },
    "stacktrace": "github.com/runatlantis/atlantis/server/events.RunAndEmitStats\n\t/home/runner/work/atlantis/atlantis/server/events/instrumented_project_command_runner.go:43\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandRunner).Plan\n\t/home/runner/work/atlantis/atlantis/server/events/instrumented_project_command_runner.go:13\ngithub.com/runatlantis/atlantis/server/events.runProjectCmds\n\t/home/runner/work/atlantis/atlantis/server/events/project_command_pool_executor.go:47\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).runAutoplan\n\t/home/runner/work/atlantis/atlantis/server/events/plan_command_runner.go:115\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).Run\n\t/home/runner/work/atlantis/atlantis/server/events/plan_command_runner.go:222\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunAutoplanCommand\n\t/home/runner/work/atlantis/atlantis/server/events/command_runner.go:174"
}

Plan Error

running "C:\\tools\\terraform.exe init -input=false -upgrade" in "C:\\Users\\xxx\\.atlantis\\repos\\xxxxx\\atlantis\\1\\default": exit status 127
/usr/bin/bash: C:toolsterraform.exe: command not found

Environment details

Using no Atlantis config file (default options)

Additional Context

usoliveira avatar Sep 06 '22 18:09 usoliveira

what are the Atlantis startup options?

jamengual avatar Sep 08 '22 00:09 jamengual

what are the Atlantis startup options?

atlantis server
	--atlantis-url=https://xxxxxxx.ngrok.io
	--gh-user=xxxxxx
	--gh-token=xxxxxxxx
	--gh-webhook-secret=xxxxxxxx
	--repo-allowlist=github.com/xxxxxxx/atlantis

usoliveira avatar Sep 08 '22 13:09 usoliveira

I never used atlantis in windows and I do not think any of the maintainers use windows, if you can run it in a virtual machine in linux for sure it will work.

we definitely do not recommend to run atlantis in production on windows.

On Thu, Sep 8, 2022 at 6:16 AM Ulisses Oliveira @.***> wrote:

what are the Atlantis startup options?

atlantis server --atlantis-url=https://xxxxxxx.ngrok.io --gh-user=xxxxxx --gh-token=xxxxxxxx --gh-webhook-secret=xxxxxxxx --repo-allowlist=github.com/xxxxxxx/atlantis

— Reply to this email directly, view it on GitHub https://github.com/runatlantis/atlantis/issues/2494#issuecomment-1240704713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ3ERBEPISOERDBOVI7YCLV5HRMVANCNFSM6AAAAAAQGB5OD4 . You are receiving this because you commented.Message ID: @.***>

jamengual avatar Sep 08 '22 15:09 jamengual

Sure. I also agree with you. But my question is, since there is a specific version for Windows, and the possibility to run it locally, is this a bug? Thanks.

I almost forgot to say, that I'm just running it locally on Windows for testing purpouse, like the documentation says about "running it locally" (not in production).

usoliveira avatar Sep 11 '22 11:09 usoliveira

If there is a Windows golang binary, it should work for Windows in my opinion, even if it's not recommended.

If you can take a look at it @usoliveira , please feel free to submit a PR.

nitrocode avatar Dec 30 '22 14:12 nitrocode