-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Init Command Cannot Parse/Download Valid Git Tags #26624
Comments
Hi @duffenterprises, I understand that this was confusing, but I'm not sure that there's a great answer here given that the version number is being represented using the typical URL query string syntax and is therefore subject to the encoding conventions of that syntax. Technically Terraform (delegating to go-getter) is working as designed here: it's decoding the query string of the URL in the standard way to get the values from it. To diverge from the typical encoding of query strings here would then make it surprising in a different way. Because Terraform is behaving as designed but the current design has a limitation as described here, I'm going to relabel this as an enhancement and leave it open so we can think about potential changes to Terraform's design that might improve this feature. I expect that this will not be a very satisfying answer due to it involving the introduction of an entirely new service, but one advantage of publishing modules using Terraform's native module registry protocol is that it's able to abstract away some of these implementation details. If the module shown in the example were indexed in a registry then the call to it in the configuration would be more straightforward, due to moving the complexity out of the configuration and into the registry server: module "my-module" {
source = "tf.example.com/my-org/my-module"
version = "0.3.0+tf.0.13.3"
project_id = var.project_id
region = var.region
} The registry protocol is, in effect, just an indirection for externalizing the construction of |
@apparentlymart Thanks for the detailed reply. I had really been hoping to provide a PR along with my issue anticipating that it was just going to need URLEncode applied at the appropriate location. That was proven incorrect in my debugging which is why I opened the issue. (It encodes the The only argument that I can make for calling this a 'bug' is that the documentation says:
And a In short term, I'll likely use a |
Thanks for the extra info, @duffenterprises. I think that documentation was written in the hope it would be clear from the context that the |
Perhaps I'll prepare a PR for the documentation. The portion that I'd still have trouble explaining if I wrote that document would be why only the ref component needs to be encoded. Encoding:
|
Terraform Version
Terraform Configuration Files
Debug Output
Crash Output
NA
Expected Behavior
Module should be downloaded
Actual Behavior
See Debug Output
Steps to Reproduce
terraform init
Additional Context
We are attempted to use semver and want to use the
metadata
section following+
to describe when we created this module (e.g.. what TF version it was first introduced against). The filegetter.go
interraform/internal/initwd/getter.go
appears to be responsible forrealAddr
before the download is attempted:A simple
realAddr = strings.Replace(realAddr, "+", "%2B", -1)
allows us to get by the issue, but doesn't seem the correct way to address this.We could ask users to to encode the path our our module like
source = "git::ssh://git@github.com/my-org/my-module.git?ref=v0.3.0%2Btf.0.13.3
but anticipate this will lead to confusion and delay.References
NA
The text was updated successfully, but these errors were encountered: