question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin can't find modules with Terraform 1.1.x

See original GitHub issue

Since I upgraded from Terraform v1.0.10 to v1.1.3 I found that the plugin is unable to find the standard terraform registry modules, hence the autosuggest doesn’t work anymore

I believe that this is due to a change in the modules.json generated, causing the plugin to fail the match between the Source value in the code with the Source value in the json file.

The observed change in modules.json is the following:

modules.json from Terraform v1.0.10

...
      "Source": "terraform-aws-modules/vpc/aws",
...

modules.json from Terraform v1.1.3

...
      "Source": "registry.terraform.io/terraform-aws-modules/vpc/aws",
...

As a workaround, I had to modify all my modules to point to the same full path registry.terraform.io/terraform-aws-modules/xxx which is not ideal, but at least I can work with it

Prerequisites

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

Installation details

  • [x ] IDE version PyCharm 2021.3.1
  • [ x ] intellij-hcl plugin version 7.14
  • [x ] Terraform version (terraform -v)
Terraform v1.1.3
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v3.72.0
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/external v2.2.0
+ provider registry.terraform.io/hashicorp/helm v2.4.1
+ provider registry.terraform.io/hashicorp/kubernetes v2.7.1
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/tls v3.1.0
+ provider registry.terraform.io/terraform-aws-modules/http v2.4.1

Expected Behavior

The plugin doesn’t show any warnings

Actual Behavior

The plugin shows a warning “Cannot locate module locally: Unknown reason” and the auto-complete doesn’t work

image

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Install terraform v1.1.3
  2. run terraform init -upgrade to refresh the modules.json file

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:79
  • Comments:10

github_iconTop GitHub Comments

6reactions
voyceycommented, May 20, 2022

@VladRassokhin - Can this be prioritised please? 4+ months for this is kind of ridiculous

6reactions
kleijnwebcommented, Jan 20, 2022

Same here, downgrade works. You can accept the suggested action, it will create .terraform/modules, the warning disappears and autocomplete works. But it would be much nicer if the plugin would be just detect .terraform/modules in the project root. Now all my submodules have a .terraform directory.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Required plugins are not installed (terraform 1.1) · Issue ...
After upgrading terraform to version 1.1 I've got error Error: Required plugins are not installed for every terragrunt command.
Read more >
Terraform plugin: Cannot locate module locally, unknown ...
Terraform itself runs perfectly fine - can see/load all the necessary modules, etc. I've had idea.log open, but I don't see any information ......
Read more >
Module Sources | Terraform - HashiCorp Developer
The source argument tells Terraform where to find child modules's configurations in locations like GitHub, the Terraform Registry, Bitbucket, Git, ...
Read more >
terraform-aws-modules/rds/aws
rds. aws. Terraform module which creates RDS resources on AWS ... This module does not create RDS security group. Use terraform-aws-security-group ...
Read more >
Terraform 1.1.X: Using libvirt in child module - Stack Overflow
The Terraform configuration must be valid before initialization so that Terraform can determine which modules and providers need to be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found