-
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
Weaken provider name segment validation to match real Terraform registries #20
Open
nfagerlund
wants to merge
9
commits into
hashicorp:main
Choose a base branch
from
nfagerlund:nf/feb23-underscores
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
304e263
Add failing parse test for provider source with `_` in namespace and …
nfagerlund 29bed2e
Add provider error checks for underscore in invalid positions
nfagerlund 1847956
Add passing test for underscore/hyphen in module namespace/name
nfagerlund 89b108c
Fix missing provided namespace in errors
nfagerlund 47e93fc
Fix missing bad hostname in errors
nfagerlund a0e17be
Change provider name part validation to match real-life registry beha…
nfagerlund c52a5bd
Update tests to match changed provider name part validation
nfagerlund 10d4a3e
go mod tidy
nfagerlund 103bf96
Update function doc to match new behavior
nfagerlund File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 of the benefits of this library, though maybe implied, rather than explicitly documented, was canonical representation, which in turn made comparison and sorting possible.
For example,
hashicorp/aws
today is treated as equal toHashiCorp/AWS
when it comes to cache entries (the lock file) etc. It is also one of the reasons Terraform LS uses this library and why we extracted it.My understanding is that the intention was merely to allow
-
, so I'm assuming there isn't a strong reason to introduce case sensitivity?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.
As best as I was able to determine, the private registry in Terraform Cloud (unlike the public registry) does not consider
myorg/aws
andmyorg/AWS
to be the same address, which would mean automatic lowercasing is a wrong behavior.But unlike the underscores, that one was based on a reading of the code rather than an actual experiment. I didn't attempt publishing a provider with capital letters in its name (which, to be fair, would be a pretty perverse thing to do, and I'm not sure anyone would try it if they weren't attempting to break something).
Org names with uppercase letters are a bit more of a pressing concern, but I didn't attempt that yet either. I could give that a shot, it's somewhat easier than re-publishing my test provider with a vandalized name.
I'm open to adding some basic string lowercasing to restore case-collapse, if you're confident that we still need it.
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.
Yeah on further thought, if capitalized org names are a problem in TFC, then the solution is to add case normalization to its registry's routing, not to change the semantics over in this library. We already know TFC enforces org name uniqueness across any combination of letter cases, and the top-level org route accounts for that; if we missed handling that somewhere deeper in the routing, we'll just fix it.