-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
terraform init -from-module does not work with -get=false #18460
Comments
Hi @brikis98! That It sounds like what you're trying to do here is use We may be able to do something here in future, but I expect it would require some significant refactoring, particularly in our new codepath (in the 0.12 development branch) where it literally is just running the module installation function with some overridden paths. To better support this sort of wrapper program, probably what we ought to do is make each of the different operations Unfortunately with our current focus on the configuration language for the next release I expect we won't be able to do much here in the short term, but we'll have another look at it once the dust has settled on those changes. |
Hi @apparentlymart!
Yup, pretty much. Perhaps it would be better for Terragrunt to just call |
I think it's probably better to have Terraform do it so that it will always match the current version of Terraform; the way it is configured is pretty standard now, but the details have slowly changed over time and will probably continue to do so. The registry installer is also within Terraform itself rather than go-getter, due to the versioning support, so registry-style paths wouldn't work. I'm on my phone right now so can't dig in to the code, but when I am at a computer I'll dig up a reference to the newer implementation of |
When we use init to download modules, set `-get=false`, `-get-plugins=false`, and `-backend=false` so that all of those can be handled in the second call to `init` (if necessary). I tried this before in #516, but had to revert it due to a Terraform bug (hashicorp/terraform#18460). I realize now that I can simply catch the error from that Terraform bug and ignore it!
Update: this is still broken in Terraform 0.12, but now with a different error message:
|
The last I saw of it was what I mentioned in my comment above. Due to this issue and #21653, Terragrunt now uses go-getter directly instead of |
I have a similar issue as well |
Terraform Version
Terraform Configuration Files
In
module/main.tf
:In
module/nested-module/main.tf
:Expected Behavior
You can run
terraform init -from-module module -get=false
without error.Actual Behavior
Steps to Reproduce
Additional Context
We use
-from-module
in Terragrunt to download remote Terragrunt configurations and the inability to disable-get
causes Terragrunt to be slower. See gruntwork-io/terragrunt#523 for context.Note that this only happens if the path I pass to
-from-module
has.tf
files in the root folder; if the.tf
files are in a subfolder (e.g., I set-from-module
to the root of some Git repo), it works fine. I'm guessing theinit
command is trying to do some sort of extra validation on the code, which is impractical if-get=false
is set. Is there any way to disable this validation?The text was updated successfully, but these errors were encountered: