You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, when looking at the module terraform-google-modules/network, it lists the following:
module"network" {
source ="terraform-google-modules/network/google"
version ="2.4.0"# insert the 3 required variables here
}
It's not documented how you would use this with the registry, the obvious solutions of terraform init --from-module=terraform-google-modules/network/google?ref=2.4.0 and ?version=2.4.0 both fail with the error:
Error: Module not found
The module address "terraform-google-modules/network/google?ref=2.4.0" could
not be resolved.
Further more, its not clear how to handle version constraints such as version = "~> 2.4".
The text was updated successfully, but these errors were encountered:
The -from-module feature is intended as an aid to getting started quickly using an existing module as a template, and so selecting a particular version of that module (rather than just taking the latest version) is not part of its featureset.
Therefore I think this issue is not really a documentation issue so much as a feature request for using a particular non-latest module version with -from-module. In that case, I'd be curious to hear more about what you are doing that requires that feature; the use-cases that motivated -from-module originally didn't require that, but perhaps you are aiming to do something a little different with the feature and we could see if extending the scope of -from-module to meet that use-case is desirable.
In this particular instance the project is using terragrunt, which makes use of the -from-module flag, so I was trying to figure out how to create a valid way to pass in a version constraint.
Ahh yes... Terragrunt is using -from-module in a slightly different way than it was intended: as a way to obtain a module to execute directly rather than to use it as a basis for creating a new configuration to be published elsewhere.
At the moment there is no way to achieve that with Terragrunt. Modules from module registries are usually modules to be called from other modules rather than to be used directly, so using directly using a registry module from Terragrunt is not a use-case the registry mechanism is anticipating; it's more common for root modules to be obtained directly from git using git clone (or some other VCS) and for the registry protocol to be used only for shared child modules that root module uses.
The current documentation for
init -from-module
does not explain how to create a validMODULE-SOURCE
for use with the terraform registry.For example, when looking at the module
terraform-google-modules/network
, it lists the following:It's not documented how you would use this with the registry, the obvious solutions of
terraform init --from-module=terraform-google-modules/network/google?ref=2.4.0
and?version=2.4.0
both fail with the error:Further more, its not clear how to handle version constraints such as
version = "~> 2.4"
.The text was updated successfully, but these errors were encountered: