Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Module cannot be located when using short form version of git source #370

Open
5 tasks done
G-Rath opened this issue Jan 8, 2022 · 3 comments
Open
5 tasks done

Comments

@G-Rath
Copy link

G-Rath commented Jan 8, 2022

Prerequisites

  • Ensure you have latest version of plugin installed
  • Search for possible issue duplicates

Installation details

  • IDE version (Help->About->Copy to Clipboard) 2021.3.1
  • intellij-hcl plugin version (Settings->Plugins) 0.7.14
  • Terraform version (terraform -v) 1.1.3

Terraform Configuration Files

module "network" {
  source = "git@github.com:org/repo.git//modules/aws/network/standard"

  name_prefix_pascal_case = local.name_prefix_pascal_case
  vpc_cidr_block          = "10.0.0.0/16"
  provision_nat_gateway   = true
}

Expected Behavior

What should have happened?
The module is found after having done a terraform init.

Actual Behavior

What actually happened?
The module is not found:

Cannot locate module locally: Unknown reason


This is looks to be because the module source in modules.json is git::ssh://git@github.com:org/repo.git//modules/aws/network/standard. If I change my source to be this value, it works fine.

@G-Rath
Copy link
Author

G-Rath commented Jan 8, 2022

It seems however this cannot be worked around if you want to use a ref, as they're provided like this:

git::ssh://git@github.com/ackama/terraform-modules.git//modules/aws/network/standard?ref=9c26d68

but get stored as:

git::ssh://git@github.com/ackama/terraform-modules.git?ref=9c26d68//modules/aws/network/standard

However, the latter is not considered a valid source by Terraform :(

@G-Rath
Copy link
Author

G-Rath commented Jan 8, 2022

I'm guessing that this logic needs to be adjusted here to handle removing the git::ssh and ref.

@johnkeates
Copy link

This also happens when it tries to refer to a submodule (and if you are in a module and it tries to resolve the module inside of that module). Not sure if that needs a separate fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants