---
version: "2.0"

delete_instance:
  type: direct

  input:
    - instance_id

  description: Deletes VM.

  tasks:
    delete_vm:
      description: Destroy VM.
      action: nova.servers_delete server=<% $.instance_id %>
      wait-after: 10
      on-success:
        - find_given_vm

    find_given_vm:
      description: Checks that VM is already deleted.
      action: nova.servers_find id=<% $.instance_id %>
      on-error:
        - succeed

