I am trying to understand destroy order... At the ...
# general
m
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
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
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
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
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
Thanks will take a look