https://pulumi.com logo
#general
Title
# general
m

mysterious-dawn-40701

01/16/2022, 9:24 AM
I am trying to understand destroy order... At the moment, when running destroy we have error similar to:
Copy code
timeout removing Node Template: Bad response statusCode [405]. Status [405 Method Not Allowed]. Body: [baseType=error, code=MethodNotAllow, message=Template is in use by a node.]
Is there any way to influence what order destroy will use
e

echoing-dinner-19531

01/16/2022, 10:17 AM
Pulumi should delete in the opposite order to the dependencies we see between resources. We see most dependencies via the use of Outputs (e.g. if you pass resourceA.Id of type Output<int> to a property of resourceB we should record a dependency there). If Outputs aren't capturing the correct dependency information you can also use the ResourceOption "dependsOn" to pass extra dependency information (https://www.pulumi.com/docs/intro/concepts/resources/#dependson) so add the NodeTemplate as a dependency of the Node and it should no longer try to delete the template until it's deleted the node.
m

mysterious-dawn-40701

01/16/2022, 12:19 PM
Yes, I found a workaround exactly by setting
dependsOn
.. Probably this is something that the provider should be doing automatically.. but it is good enough as it is now. Thanks a lot!
e

echoing-dinner-19531

01/16/2022, 12:33 PM
If you could ping us some code of how your creating the node and nodetemplate we could take more of a look into why the system didn't infer this automatically.
Either here or raise an issue on github
m

mysterious-dawn-40701

01/16/2022, 1:41 PM
the same as in here.. but using the new API
I am now doing
Copy code
// Create cluster
    const cluster = new rancher2.Cluster(this.name, cluster_args, {
      provider: this.rancher.localAdmin,
      dependsOn: Array.from(this.rancher.nodeTemplates.values()),
    });
and it works
e

echoing-dinner-19531

01/16/2022, 2:38 PM
Thanks will take a look