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

Module not found, may need to be downloaded using 'terraform get' #8724

Closed
joshuaspence opened this issue Sep 8, 2016 · 20 comments · Fixed by #8803
Closed

Module not found, may need to be downloaded using 'terraform get' #8724

joshuaspence opened this issue Sep 8, 2016 · 20 comments · Fixed by #8803

Comments

@joshuaspence
Copy link
Contributor

After updating to Terraform 0.7.3, I am getting the following error when running terraform plan:

Error downloading modules: module REDACTED: not found, may need to be downloaded using 'terraform get'

This issue doesn't seem to occur in Terraform 0.7.2. I will work on a MWE to reproduce this issue.

@joshuaspence
Copy link
Contributor Author

> TF_LOG=debug terraform get -update=true $(readlink templates)
2016/09/08 12:58:54 [INFO] Terraform version: 0.7.3  0dd7c657d6d60d2e7392b66ae6f74fb84582cab9
2016/09/08 12:58:54 [INFO] CLI args: []string{"/usr/local/bin/terraform", "get", "-update=true", "../../../templates/REDACTED"}
2016/09/08 12:58:54 [DEBUG] Detected home directory from env var: /home/josh
2016/09/08 12:58:54 [DEBUG] Detected home directory from env var: /home/josh
2016/09/08 12:58:54 [DEBUG] Attempting to open CLI config file: /home/josh/.terraformrc
2016/09/08 12:58:54 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/09/08 12:58:54 [DEBUG] Detected home directory from env var: /home/josh
2016/09/08 12:58:54 [INFO] state modified during read or write. incrementing serial number
Get: file:///home/josh/workspace/REDACTED/src/modules/iam (update)
Get: file:///home/josh/workspace/REDACTED/src/modules/iam/configuration (update)
Get: file:///home/josh/workspace/REDACTED/src/modules/iam/ssl_certificates (update)
Get: file:///home/josh/workspace/REDACTED/src/modules/instance (update)
Get: file:///home/josh/workspace/REDACTED/src/modules/user_data (update)
2016/09/08 12:58:54 [DEBUG] plugin: waiting for all plugin processes to complete...

> TF_LOG=debug terraform plan templates/
2016/09/08 12:59:36 [INFO] Terraform version: 0.7.3  0dd7c657d6d60d2e7392b66ae6f74fb84582cab9
2016/09/08 12:59:36 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan", "templates/"}
2016/09/08 12:59:36 [DEBUG] Detected home directory from env var: /home/josh
2016/09/08 12:59:36 [DEBUG] Detected home directory from env var: /home/josh
2016/09/08 12:59:36 [DEBUG] Attempting to open CLI config file: /home/josh/.terraformrc
2016/09/08 12:59:36 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/09/08 12:59:36 [DEBUG] Detected home directory from env var: /home/josh
2016/09/08 12:59:36 [INFO] state modified during read or write. incrementing serial number
2016/09/08 12:59:36 [DEBUG] plugin: waiting for all plugin processes to complete...
Error downloading modules: module REDACTED: not found, may need to be downloaded using 'terraform get'

@llarsson
Copy link

llarsson commented Sep 8, 2016

Happened to me too, had to delete old modules in .terraform/modules to get a terraform get -update working again.

Does terraform encode something version-specific in its modules, which makes this an expected behavior? I don't remember having to do this between 0.7.1 and 0.7.2, but definitely between 0.7.2 and 0.7.3.

@mitchellh
Copy link
Contributor

This is mentioned in the CHANGELOG as a slight BC-change in 0.7.3: we changed some internal structures requiring you to run terraform get again.

@joshuaspence
Copy link
Contributor Author

Thanks for the feedback. Admittedly, I didn't read the changelog. But I did run terraform get before getting this error message. I'll play around a bit more later today and see if I can reproduce again.

@joshuaspence
Copy link
Contributor Author

Yeah, this definitely doesn't seem to be working as expected. I ran git clean -f -d -x (which removed a whole bunch of .terraform/modules/ files) and I am still seeing the original error.

@joshuaspence
Copy link
Contributor Author

I'm not sure if it's relevant, but we are using relative paths for our modules.

module "module" {
  source = "../../../modules/some_module"
}

@joshuaspence
Copy link
Contributor Author

If I revert #8398 then I no longer get an error.

@joshuaspence
Copy link
Contributor Author

I've created a small repository that can be used to reproduce the issue, see https://github.com/joshuaspence/terraform-issue8724-test. To reproduce the error with Terraform 0.7.3, follow these steps:

git clone https://github.com/joshuaspence/terraform-issue8724-test
cd environments/production
rm -rf .terraform/
terraform get $(readlink -f templates/)
terraform plan templates/

It could be our use of symlinks that is causing the issue. We use symlinks so that we can use the same set of Terraform files to produce multiple identical environments (eg. dev, staging and production).

@joshuaspence
Copy link
Contributor Author

It looks like I can't reopen this issue but it would be appreciated if someone else could re-open it for me.

@mootpt
Copy link
Contributor

mootpt commented Sep 12, 2016

reopened

@mootpt mootpt reopened this Sep 12, 2016
@mitchellh
Copy link
Contributor

Relevant comment/commit here that introduced this: #8398 (comment)

I think most importantly in addition to simply reverting we'll need to add regression testing around this since I was able to get the above commit in without any failing tests.

@joseph-wortmann
Copy link

joseph-wortmann commented Sep 12, 2016

We also use relative paths to (many) modules here, and have not been able to get 0.7.3 to run in Atlas. Nothing I've tried yet seems to make a difference, including deleting my existing local modules before doing a get/push.

For the moment I've reverted to 0.7.2 across the board.

UPDATE: I just tried 0.7.4 and it is displaying the same behavior as 0.7.3 was re: existing environments in Atlas. Not fixed...

@jbardin
Copy link
Member

jbardin commented Sep 12, 2016

hashicorp/go-getter#28 seems to be the root issue here, causing an invalid module path when starting from a relative symlink.

@brianknight10
Copy link

Also confirming an issue in 0.7.3 with relative paths to modules. Using 0.7.2 locally and setting Atlas to run the environment with 0.7.2 resolved the issue for now.

@mitchellh
Copy link
Contributor

Ah hah, @jbardin has a nice fix up that looks great.

@joshuaspence
Copy link
Contributor Author

For some reason, Terraform 0.7.3 was working for some people in our company but not for others. As a result, I am now unable to use Terraform 0.7.2 (because the state file was last updated with Terraform 0.7.3) and also unable to use Terraform 0.7.3 (because of this issue). Is there any chance of cutting a new release soon?

@brianknight10
Copy link

I see that this has been closed, but it doesn't seem to be included in the CHANGELOG for version 0.7.4 or 0.7.5, nor has the behavior changed. Has this not been included in a release yet?

@srossross-tableau
Copy link

srossross-tableau commented Oct 18, 2017

I'm using terraform v0.10.7 on osx and I am getting the same error. Is this expected?

(srossross-mac3 tfexample •‿•) terraform apply envs/development/
Failed to load root config module: Error loading modules: module child: not found, may need to be downloaded using 'terraform get'
# File envs/development/main.tf
module "child" {
  source = "../../modules/child"
  memory = "10G"
}

This seems like it will be less than ideal when I am developing on my child module. Will I need to run terraform get then terraform apply each time I make a change?

@xmakina
Copy link

xmakina commented Oct 27, 2017

@srossross-tableau try running terraform get

@ghost
Copy link

ghost commented Apr 6, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants