GIT_PROVIDER_CONFIG required placeholders, eg: {namespace}
#103
Replies: 2 comments 1 reply
|
Hey @freakinhippie , Yes and no.
The main reason I imagine that they're all enforced is to try to avoid conflicts. But, I'm not massively commited either way :) If there's a useful situation without the namespace, then it makes sense to remove. |
|
I recognize that the Hashicorp Terraform Registry has some constraints that appear to have been adopted by For a time, my organization self hosted an internal SCM system which mapped neatly to the For example, using Github as the example SaaS offering since that's what Hashicorp TFR expects, suppose these modules and corresponding git provider configs exist: NOTE: please ignore that each team has a
GIT_PROVIDER_CONFIG: [
{ /* ID=1 */
"name": "Github",
"base_url": "https://github.com/my_org/{module}",
"clone_url": "ssh://git@github.com/my_org/{module}.git",
"browse_url": "https://github.com/my_org/{module}/tree/{tag}/{path}"
},
{ /* ID=2 */
"name": "Github [ns:sec]",
"base_url": "https://github.com/my_org/secops-{module}",
"clone_url": "ssh://git@github.com/my_org/secops-{module}.git",
"browse_url": "https://github.com/my_org/secops-{module}/tree/{tag}/{path}"
},
{ /* ID=3 */
"name": "Github [ns:team]",
"base_url": "https://github.com/my_org/{namespace}-{module}",
"clone_url": "ssh://git@github.com/my_org/{namespace}-{module}.git",
"browse_url": "https://github.com/my_org/{namespace}-{module}/tree/{tag}/{path}"
}
]I thought that I could address my namespace mapping/collision problems with this sort of setup, but then I encountered the error mentioned above. Subsequently when looking at the code it appears that the repo prefixes of I don't know if there is an appetite to address this limitation, or if the existing Terrareg user base (besides myself) would benefit from it. I could imagine adding another placeholder such as [
{ /* ID=1 */
"name": "Github",
"base_url": "https://github.com/my_org/{prefix}{module}",
"clone_url": "ssh://git@github.com/my_org/{prefix}{module}.git",
"browse_url": "https://github.com/my_org/{prefix}{module}/tree/{tag}/{path}"
},
{ /* ID=2 */
"name": "Github [ns:sec]",
"base_url": "https://github.com/my_org/secops-{prefix}{module}",
"clone_url": "ssh://git@github.com/my_org/secops-{prefix}{module}.git",
"browse_url": "https://github.com/my_org/secops-{prefix}{module}/tree/{tag}/{path}"
},
{ /* ID=3 */
"name": "Github [ns:team]",
"base_url": "https://github.com/my_org/{namespace}-{prefix}{module}",
"clone_url": "ssh://git@github.com/my_org/{namespace}-{prefix}{module}.git",
"browse_url": "https://github.com/my_org/{namespace}-{prefix}{module}/tree/{tag}/{path}"
}
]Unfortunately, this suggestion is just a half-baked solution at best. |
Uh oh!
There was an error while loading. Please reload this page.
I'm curious about the reasoning behind the checks in
terrareg/models.pythat confirm that the{namespace}placeholder is present in each of the URLs in theGIT_PROVIDER_CONFIGsetting.For example, if I run this:
The app produces the following error:
This prevents me from being able to define a namespace in Terrareg that doesn't align with the repo URL.
It seems to me that the URLs should simply use the placeholder if it is defined without the validation, but as the validation is there I have to assume there is a good reason for it. And I didn't want to raise an issue for it without understanding the background.
All reactions