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

Add module name to the output #68

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add module name to the output #68

wants to merge 3 commits into from

Conversation

yhekma
Copy link

@yhekma yhekma commented Nov 8, 2021

Added the name of the module to the tabled output.
Example output:

| UPDATE? |             NAME   |             MODULE NAME              | CONSTRAINT |      VERSION      | LATEST MATCHING | LATEST |
|---------|--------------------|--------------------------------------|------------|-------------------|-----------------|--------|
| (Y)     | adf                | terraform-azurerm-datafactory        |            | v1.5.0            |                 | v2.0.2 |
| (Y)     | databricks_request | terraform-azurerm-org-data-request   |            | v0.0.1            |                 | v0.0.3 |

@@ -22,7 +24,8 @@ func Parse(raw tfconfig.ModuleCall) (*Parsed, error) {
if err != nil {
return nil, fmt.Errorf("parse module call source: %w", err)
}
out := Parsed{Source: src, Raw: raw}
name := src.Git.Remote[strings.LastIndex(src.Git.Remote, "/")+1:]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will panic on non-git remotes

@sgreben
Copy link
Member

sgreben commented Nov 8, 2021

Hey! Thanks for thinking about how to improve tf-module-versions 👍

I'm not sure whether there really is a well-defined "source name" other than the source URL - it would really be the "source basename" (in the sense of unix basename) - and we do have the full source URL included in the markdown-wide and structured output formats.

I'm fine with adding a name, but only if we can reliably define it consistently for any module source (consider also host.com/org/repo.git vs host.com/org/repo, or hashicorp/consul, or ../modules/abc/.). This isn't clear to me yet.

@yhekma
Copy link
Author

yhekma commented Nov 8, 2021

Hey, thanks for the feedback. Those are good points, I should have at least checked against the examples. I think this feature makes no sense with local modules but I think now it works as you would expect.

@yhekma
Copy link
Author

yhekma commented Nov 8, 2021

wrt the full name, I thought it would be useful to have the basename in the default output since the full url can get messy/long (but I do agree the information is there in the wide output, so if you don't agree this has added value, I could live with that :))

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

Successfully merging this pull request may close these issues.

2 participants