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

Error on a plan or apply when calling a module from a local filesystem location #36163

Closed
David-Pickwell-Hearst opened this issue Dec 5, 2024 · 2 comments · May be fixed by hashicorp/go-slug#79
Labels
bug cloud Related to Terraform Cloud's integration with Terraform new new issue not yet triaged working as designed confirmed as reported and closed because the behavior is intended

Comments

@David-Pickwell-Hearst
Copy link

Terraform Version

> terraform --version
Terraform v1.10.0
on windows_amd64
+ provider registry.terraform.io/hashicorp/aws v5.78.0
+ provider registry.terraform.io/hashicorp/null v3.2.3
+ provider registry.terraform.io/hashicorp/random v3.6.3

Terraform Configuration Files

module "user_data" {
  source = "c:/Repositories/TerraformModules/terraform-aws-ec2-userdata"

  some_var = var.some_var
}

Debug Output

https://gist.github.com/David-Pickwell-Hearst/23a4243b3dffcdb64ea2f182b87f8366

Expected Behavior

When a plan or an apply is executed the code should be able to consume locally developed modules.

This works in version 1.9.8 and before with no issue, and rolling back resolves this.

This bug is also in version 1.10.1.

As a note, this happens regardless of whether you source it when an absolute or relative path.

Actual Behavior

The plan and the apply fails with an error message:

Terraform v1.5.7
on linux_amd64
Initializing plugins and modules...
Initializing Terraform Cloud...Initializing modules...Downloading c:/Repositories/TerraformModules/terraform-aws-ec2-userdata for windows_vm.user_data...
╷
│ Error: Failed to download module
│
│   on ../main.tf line 113:113: module "user_data" {
│
│ Could not download module "user_data" (../main.tf:113) source code from
│ "c:/Repositories/TerraformModules/terraform-aws-ec2-userdata": download not
│ supported for scheme 'c'
╵
Operation failed: failed running terraform init (exit 1)

Steps to Reproduce

  1. Create a module that sources a second module from a location on the local file system
  2. Run a terraform init and terraform validate
  3. Run a terraform plan and it will fail with the above message.

Additional Context

With our module developmeent, we often have modules that are interlinked.

For instance, an ec2-linux module will be developed and in tandem an ec2-userdata module will also be developed. This requires the need to have the ability to source all child modules locally, as was able in the <1.9.x versions

References

No response

@David-Pickwell-Hearst David-Pickwell-Hearst added bug new new issue not yet triaged labels Dec 5, 2024
@liamcervante liamcervante added the cloud Related to Terraform Cloud's integration with Terraform label Dec 5, 2024
@jbardin
Copy link
Member

jbardin commented Dec 5, 2024

Hi @David-Pickwell-Hearst,

A "local" module must be locatable relative to the root module of the configuration, so must start with ./ or ../. See local paths in the module source documentation.

With the output of Initializing Terraform Cloud it doesn't look like you are actually running the plan locally, but rather sending it to Terraform Cloud, which must be able to locate the files on it's own, and the path c:/Repositories/TerraformModules/terraform-aws-ec2-userdata does not exist on the remote system

We use GitHub issues for tracking bugs and enhancements, rather than for questions. While we can sometimes help with certain simple problems here, it's better to use the community forum where there are more people ready to help.

Thanks!

@jbardin jbardin closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2024
@jbardin jbardin added the working as designed confirmed as reported and closed because the behavior is intended label Dec 5, 2024
Copy link
Contributor

github-actions bot commented Jan 5, 2025

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug cloud Related to Terraform Cloud's integration with Terraform new new issue not yet triaged working as designed confirmed as reported and closed because the behavior is intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants