-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
depends_on cannot be used in a module #10462
Comments
Hi @chrisrlong This is very strange - we introduced depends_on for modules in 0.8.0-beta2 can you run terraform version and post the output here for me? Paul |
Hi @stack72, I have complied master from version b15b8bd (Terraform v0.8.0-dev (b15b8bd+CHANGES)), which should include beta2 features. (I did this to get 10337 and 10338 fixes) It seems it would work if you set a resource to depend on a module, but you cannot set a module to depend_on another module...... Thanks for the great tool btw ;) Chris |
Hi @chrisrlong thanks for getting back to me - you are indeed correct - modules cannot (currently) depend_on other modules but can depend on a resource only Will change the tag on this from bug to enhancement :) Keep an eye out for it soon ™️ Thanks Paul |
Retagging as enhancement, since this isn't broken functionality, its functionality that doesn't exist yet. :) |
My use case: the slave virtual machine depends on master virtual machine to exist |
I am seeing the same error: My Terraform version is: My use case is that I want a module to depend on a resource. |
Error loading Terraform: module root: module etcdbastion: depends_on is not a valid parameter. |
@mitchellh I believe this one can solve unnested modules problem too. There were some issues regarding this #10883 before. This solution would be intuitive and address these issues. |
Waiting for this feature to be added 👍 |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
7 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Anyone have a good workaround for this in the meantime? |
My pseudo workaround is to add a list variable inside the module: variable "depends_on" { default = [], type = "list" } Then when using the module, pass it a computed value from the resource I want it to depend on: module "something" {
depends_on = ["${aws_instance.instance.private_ip}"]
} |
Thanks, that doesn't entirely fit what I think this issue is talking about though - making a module able to depend on another one. I don't have any resources that the module should depend on - it should depend on another module being created. I've tried doing stuff like this:
module 2:
Main terraform template:
But this doesn't do anything - my module two is still created at basically the same time as module 1. |
@AirbornePorcine In your second module you need to actually use the wait_for_cluster variable somewhere that establishes a dependency. Such as in a template or a trigger on a See #1178 (comment) from @kristjanelias The only change I'd make to his workaround is to maybe make the dummy dependency resource use a trigger so it changes when the instance changes. resource "null_resource" "dummy_dependency" {
triggers {
dependency_id = "${aws_instance.instance.id}"
}
} |
Ah, that makes sense! Should have known that Terraform would optimize away my variable if I didn't use it. :) I tried out your suggestion with the trigger and that didn't do it, but setting the depends_id on a tag on some resource in module 2 seems to have done it. Hacky but oh well I guess. |
Thank you @danieldreier – epic update and the transparency is appreciated! I think we can finally all rest easy that this is coming ^_^ |
Thanks is good news @danieldreier. Time will come to remove all the work arounds soon then... |
Glad to hear! super exciting |
Thanks @danieldreier we are looking forward to that ! As I cannot see anyone else reporting a specific issue related to module dependencies that I'm encountering, I'll report it here. I hope that the support of "depends_on" on modules will resolve that, but I'm not quite sure. Any idea ? With some code like this:
Terraform raise the following error (at plan or apply):
|
I think I managed to create a valid workaround for this: https://github.com/matti/terraform-module-depends_on It requires modules to have some boilerplate, but otherwise it seems to work fine. |
@danieldreier @apparentlymart Thanks for the update and putting the emphasis on this, it is greatly appreciated. |
@danieldreier Great to hear you guys are working on this. Have you guys been able to scope and figure out a timeline for the project yet? Roughly when this is planned to be released is one of the deciding factors for if my team will be using TFC or switching to Pulumi. Can you provide any broad information on when this will be released (week/month/year)? Edit: Others might still need an ETA but we don't. The lack of communication (both on GitHub and via support email) about any estimates as to when Hashicorp will complete features they've committed to has resulted in my team canceling our TFC subscription. We're now moving to Pulumi. |
@solidDoWant While I appreciate the need for you and others to plan, we are not yet in a position to communicate any timelines. My hope above was to begin communicating what we’re currently focused on more publicly. I can give a few details on the larger first-class module project that this is a part of to help you with your planning:
|
That prioritization makes a lot of sense to me. Looking forward to it! |
Great, 3 years in, looking forward to having this needed feature. |
This is a really important feature to have in my opinion. It would make the code much more readable and maintainable than by using one of the hack that we find on blog posts. |
Can anyone please give a time line on when this feature will be released? |
Wow, over three years and still nothing?! |
three years is nothing in terraform time |
@max-l-weaver with this comment, you are showing how unappreciative and ignorant you can be. You can fault the devs for not getting this right with modules from the start, but aside from that, you should have more awareness of reality and what these changes have required before sharing those types of crass comments. In fact, you should probably not use any open source software, as the type of comment you left above are one of the major reasons why application developers give up on open source. Please be more kind and appreciative in your comments, or leave them to yourself. |
Just because the software is open source doesn't mean we aren't paying for it. Many of us (myself previously included) pay a monthly or yearly fee for Terraform/TFC and in term expect support and timely software updates. The fact that Hashicorp rarely if ever shares roadmaps or any kind of even a guess at a timeline quite frankly makes it unusable for business critical services, such as the infrastructure backing software company's services. The lack of communication on one of, if not the most requested feature of the last 3-4 years is not something to appreciate. |
@solidDoWant , chillrex man... Many people "pay a monthly" and wait patiently for a new feature. They decided to implement it which is great news, crass comments like these do not help anyone. |
@solidDoWant There are various workarounds for this feature that currently exists, such using templates to generate tf files, so its not really a showstopper. We should be thankful that they even prioritized this at all. |
To clarify, my issue isn't at all with the lack of the feature - it's with the lack of communication. I would be fine with Hashicorp never developing this feature, but I take issue with Hashicorp not being able to even take a guess as to when it will be completed, if at all. It's great that they've communicated that this is a top priority, as that address the 'if it will happen', but they haven't addressed the 'when'. This Github issue isn't the only place affected by the underlying company issue either. There are 136 PRs on this repo alone (not to mention the numerous providers) that are open. Out of those 135, only one has been assigned a milestone. Roughly 15 haven't even been commented on. On most of these there is no indication when, or if these PRs will be addressed. Not great from a user's perspective when there's a fix you're waiting on in one of them, or in a developer's perspective when your PR sits open for months or years. Hashicorp makes some cool tools and (from what I've seen) most of their code is pretty solid. I've no issues with the software developers, but their product strategy and overall communication leaves a lot to be desired. |
@danieldreier can you please lock this issue to contributors only? I believe at this point just about every constructive comment that could be made, has already been made. There are likely hundreds of people subscribed to this issue, and we don't all need to get an email every time someone wants to complain. I'll be happy if the next time I hear about this feature is when it's done. |
Thanks for clarifying.
I can understand that frustration, I agree Hashicorp could improve their communication with us as users of various kinds. However, WRT this general topic of first-class modules, I believe Hashicorp has been pretty clear, and within the bounds of what's possible (and also avoiding making unnecessary expectations which they may fail to deliver on). For example, in the 3 years that this has transpired, we've seen the following:
Particularly for those last two, no timelines (with unreasonable expectations) were laid down. Yea, I would have loved to see 0.12 completed sooner, or dev on 0.13 to have started sooner, but I'd rather this than to have a product which is all over the place, poorly developed, poorly designed, lots of major breaking changes, and just generally moving to the whims of the wind as it blows. |
@ketzacoatl please take a deep breath and calm down. Imo Hashicorp market themselves as a software provider that provides solutions for businesses. If it was some dude working on his own in his basement then of course i wouldn't post such ignorant comments, however the fact that this feature has been open for over three years with no communication is a little disconcerting. I apologise if you felt somehow attacked by my comment. |
Please take the complaints to twitter or reddit. I'm subscribed to this thread for news about the feature only. |
Based on the feedback here, I've locked this discussion. We're actively working on module expansion. The engineers are making good progress, and I am excited about 0.13. For folks who are really upset, I'm ddreier@hashicorp.com and I'm happy to talk. |
I'm very excited to announce that beta 1 of terraform 0.13.0 will be available on June 3rd, and will include module |
Hi there,
Terraform Version
0.8.0 rc1+
Affected Resource(s)
module
Terraform Configuration Files
Debug Output
Error loading Terraform: module root: module legacy_site: depends_on is not a valid parameter
module root: module legacy_site: depends_on is not a valid parameter
Expected Behavior
I am trying to use the new depends_on instead of the above outputs, so I create and provision my app once I know database and caches are built.
Actual Behavior
Nothing as terraform errors out as above.
Steps to Reproduce
terraform apply
References
depends_on can reference modules. This allows a resource or output to depend on everything within a module. (#10076)
The text was updated successfully, but these errors were encountered: