When teardown task fails to run the instance is still being deleted

When deleting an instance, during the teardown phase if the attached script fails to run properly or errors for whatever reason, the instance is still being deleted. Is this expected behaviour?

Is there a way to stop the deletion process if the teardown task fails or based on certain logic defined on the teardown task?

Teardown phase is best effort with the current implementation of our orchestration engine.

Reasoning(s):

  • If the VM is powered off and you have tasks that execute on resource they will always fail. We do not power back on systems that can cause all sorts of issues.
  • If there is a failure to the task and we don’t delete we can cause additional charges based on consumption/other with the cloud providers.

Feels like this would require the introduction of some sort of ‘pre-teardown’ phase, which got triggered before the actual teardown phase started? The script could be run in that phase, and the actual teardown would only begin if the script completed successfully.
@cbunge Would that work if Morpheus had that?