-
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 create/destroy dependencies between resources #22572
Comments
Thanks for sharing this use-case, @brokoli18! This seems like it might be another good example case for developing the idea in #22094. This new situation is special in a couple of ways:
This particular relationship is subject to the problem described under "Global Object IDs for multi-instance systems" in that issue, because a Kubernetes cluster is identified only by its location but it ought to be possible to move a Kubernetes cluster (a self-hosted one, most likely) to a different physical network address without implying that everything in its is destroyed and recreated. |
Thank you for the detailed response |
Thank you |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Current Terraform Version
Use-cases
I have a k8s cluster deployed in google, on which I then deploy some resources using terraform. A short example is below:
If I were for example to change the location of the
google_container_cluster
the entire resource would be recreated. However this would mean that the above namespace is destroyed on the cluster, but remains as a resource in the terraform state file. I would like to add a dependency between thegoogle_container_cluster
and thekubernetes_namespace
so that terraform is aware that when the cluster is recreated the namespace would need to be recreated as well.Attempted Solutions
An example of the behavior I would like to replicate is the
triggers
argument available for null-resources. https://www.terraform.io/docs/providers/null/resource.html#triggers.I know that it is also possible to use the
depends_on
argument for resources, but from what I can see this only affects the order in which resources are initially provisioned and would not achieve the behavior I am describing above. Perhaps I am mistaken?Proposal
Essentially I would like to replicate the
triggers
option available fornull_resources
for other resources in terraform, specifically the kubernetes and helm providers.References
The text was updated successfully, but these errors were encountered: