-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add module source address parsing #7
Conversation
74e07a4
to
bec8935
Compare
This enabled parsing of module source addresses for local and registry modules.
bec8935
to
6d9c659
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM aside from one question/aspect:
Is there a particular reason for including ParseRawModuleSource
, ModuleSourceLocal
and the ModuleSource
interface? The detection of local modules doesn't seem all that complicated and I think we could get away with it living either in terraform-ls, or potentially under terraform-schema
: https://github.com/hashicorp/terraform-ls/blob/94aa1d8d66f28441fbf8e3273eefcc5554b9b817/internal/terraform/datadir/module_types.go#L61-L68
I guess there may be a convenience argument for including it, but the risk is that this gives anyone the expectation that the function can parse any valid module source address and I'd really prefer to avoid that scope creep, if possible - esp. because that allows us to avoid go-getter.
Maybe we'll re-scope the library as hashicorp/terraform-address
at some point, but I'd prefer not to do that unless it's really necessary.
Good call! I've removed the code related to local module parsing, and without the I updated the example and removed the type cast. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more question + docs fix 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
This PR adds the parsing of module source addresses for registry modules. It exposes one new function:
ParseRawModuleSourceRegistry
It's based on the
internal/addrs/module_source.go
code in terraform core with some modifications:ModuleSourceRemote
(e.g. GitHub or Bitbucket)ModuleSourceLocal
(e.g../example
)internal/getmodules
ModuleSourceRemote
SourceDirSubdir
Example usage
Enables hashicorp/terraform-ls#877