Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to run mklink #733

Closed
mmclane opened this issue Jun 10, 2019 · 14 comments · Fixed by #739
Closed

failed to run mklink #733

mmclane opened this issue Jun 10, 2019 · 14 comments · Fixed by #739
Labels

Comments

@mmclane
Copy link

mmclane commented Jun 10, 2019

I just upgraded to terragrunt v0.19.0 this morning. I am running Terraform v0.12.1. I am running on Windows with Powershell. I am trying to setup an example repo based on terragrunt to show to my team for possible adoption.

When I run terragrunt init or terragrunt plan I get the following:

terragrunt init
[terragrunt] [C:\Users\matt.mclane\repos\llamasoft\terraform\environments\prod\network] 2019/06/10 10:11:48 Running command: terraform --version
[terragrunt] 2019/06/10 10:11:48 Reading Terragrunt config file at C:/Users/matt.mclane/repos/llamasoft/terraform/environments/prod/network/terragrunt.hcl
[terragrunt] 2019/06/10 10:11:48 Downloading Terraform configurations from file://C:/Users/matt.mclane/repos/llamasoft/terraform/modules into C:/Users/matt.mclane/repos/llamasoft/terraform/environments/prod/network/.terragrunt-cache/j11A824preQo1pkd4TD25NjWlKs/5dESSr0bTp-_uymXIM66yNDT_Yo
[terragrunt] 2019/06/10 10:11:48 Hit multiple errors:
error downloading 'file://C:/Users/matt.mclane/repos/llamasoft/terraform/modules': failed to run mklink C:/Users/matt.mclane/repos/llamasoft/terraform/environments/prod/network/.terragrunt-cache/tmp-download-Ry4o94 C:\Users\matt.mclane\repos\llamasoft\terraform\modules: exit status 1 "Invalid switch - "Users".\r\n"
[terragrunt] 2019/06/10 10:11:48 Unable to determine underlying exit code, so Terragrunt will exit with error code 1
All the paths seem correct.

@brikis98
Copy link
Member

What's in terragrunt.hcl?

@mmclane
Copy link
Author

mmclane commented Jun 10, 2019

Here is an example:

terraform {
source = "../../../modules//network"
}

inputs = {
env_name = "dev"
region = "us-west-2"
vpc_cidr = "192.168.100.0/24"
}

@mmclane
Copy link
Author

mmclane commented Jun 10, 2019

For what its worth, it works when I run terragrunt on Linux.

@brikis98
Copy link
Member

Could you set the TERRAGRUNT_DEBUG env var to true so we might get a stack trace?

@mmclane
Copy link
Author

mmclane commented Jun 11, 2019

I get the same result:

~....\terraform....\network git: master ≣ ❯ $env:TERRAGRUNT_DEBUG=true
~....\terraform....\network git: master ≣ ❯ tg plan
[terragrunt] [C:\Users\matt.mclane\repos\llamasoft\terraform\environments\dev\network] 2019/06/11 08:30:44 Running command: terraform --version
[terragrunt] 2019/06/11 08:30:44 Reading Terragrunt config file at C:/Users/matt.mclane/repos/llamasoft/terraform/environments/dev/network/terragrunt.hcl
[terragrunt] 2019/06/11 08:30:44 Downloading Terraform configurations from file://C:/Users/matt.mclane/repos/llamasoft/terraform/modules into C:/Users/matt.mclane/repos/llamasoft/terraform/environments/dev/network/.terragrunt-cache/EvQCp2RmwG2McT-j-KP4avBfktc/5dESSr0bTp-_uymXIM66yNDT_Yo
[terragrunt] 2019/06/11 08:30:44 Hit multiple errors:
error downloading 'file://C:/Users/matt.mclane/repos/llamasoft/terraform/modules': failed to run mklink C:/Users/matt.mclane/repos/llamasoft/terraform/environments/dev/network/.terragrunt-cache/tmp-download-YtsWeH C:\Users\matt.mclane\repos\llamasoft\terraform\modules: exit status 1 "Invalid switch - "Users".\r\n"
[terragrunt] 2019/06/11 08:30:44 Unable to determine underlying exit code, so Terragrunt will exit with error code 1

@brikis98
Copy link
Member

Hm, I think we're on an old version of go-getter... Newer versions have fixed symlink issue bugs on Windows: hashicorp/go-getter#159

I'll submit a PR to update us... I may also try to switch to copying instead of symlinks in general as that may fix #736.

@mmclane
Copy link
Author

mmclane commented Jun 11, 2019

Let me know if I can help test.

@brikis98
Copy link
Member

I think this may be a bug in go-getter that hasn't been fixed, actually:

hashicorp/go-getter#51
hashicorp/go-getter#139

@brikis98
Copy link
Member

@mmclane Any chance you have a go environment working on your Windows box? If so, could you checkout the go-getter-update branch to see if #739 fixes your issue?

Instead of running terragrunt apply, you can run go run main.go apply with the source code.

@mmclane
Copy link
Author

mmclane commented Jun 11, 2019

Unfortunately I don't have that environment setup. I tried to pull it down and run the following:
go run main.go plan --terragrunt-source C:\Users\matt.mclane\repos ...

But I get all sorts of errors about missing packages

@ekini
Copy link
Contributor

ekini commented Jun 11, 2019

You can get Go>=1.12 and run

go mod init
go build

That should just work.

@brikis98
Copy link
Member

Oh, neat, didn't know Terragrunt already worked with go mod. Officially, we are using dep until go mod is the de-facto tool in the next Go version, so you could also install dep and run dep ensure to download the dependencies. But if go mod works, that's probably the easiest route!

@brikis98
Copy link
Member

Give https://github.com/gruntwork-io/terragrunt/releases/tag/v0.19.1 a shot. New binaries should show up in a few minutes.

@mmclane
Copy link
Author

mmclane commented Jun 12, 2019

Yep, that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants