IDE support when defining modules in Terrafile

I’m currently setting up a new project with terraspace and I’m using Goland from Jetbrains as my IDE since I mostly have to write Go, but also do some IaC in the same project. But I guess the problem I have applies to other IDEs as well.

Goland hat a Terraform plugin that for example has auto completion and checks which variables of a module I use need to be set. When using my own modules in app/modules, and referencing those via source = "../../modules/bla" from within a stack that works, because the IDE is able to find the module. However, when using a module I specified in the Terrafile, e.g. mod "s3", source: "terraform-aws-modules/s3-bucket/aws" the IDE is of course not able to find the module because only during the build step, the module is copied from the vendor/modules directory to the .terraspace-cache.

Any tips on how to resolve that problem? With terragrunt, which I was using in previous projects, I would just specify the registry path in the module, and could then do a terraform init to download the module code, and the IDE would be able to parse it. While that is certainly not a pretty solution, it at least worked :smiley: