def detach
      attachment_name = args.shift
      raise CommandFailed.new("Missing add-on attachment name") if attachment_name.nil?
      requires_preauth

      addon_attachment = resolve_attachment!(attachment_name)

      attachment_name = addon_attachment['name'] # in case a UUID was passed in
      addon_name      = addon_attachment['addon']['name']
      app             = addon_attachment['app']['name']

      action("Removing #{attachment_name} attachment to #{addon_name} from #{app}") do
        api.request(
          :expects  => 200..300,
          :headers  => { "Accept" => "application/vnd.heroku+json; version=3" },
          :method   => :delete,
          :path     => "/addon-attachments/#{addon_attachment['id']}"
        ).body
      end
      action("Unsetting #{attachment_name} vars and restarting #{app}") do
        @status = api.get_release(app, 'current').body['name']
      end
    end
def detach
      attachment_name = args.shift
      raise CommandFailed.new("Missing add-on attachment name") if attachment_name.nil?
      requires_preauth

      addon_attachment = resolve_attachment!(attachment_name)

      attachment_name = addon_attachment['name'] # in case a UUID was passed in
      addon_name      = addon_attachment['addon']['name']
      app             = addon_attachment['app']['name']

      action("Removing #{attachment_name} attachment to #{addon_name} from #{app}") do
        api.request(
          :expects  => 200..300,
          :headers  => { "Accept" => "application/vnd.heroku+json; version=3" },
          :method   => :delete,
          :path     => "/addon-attachments/#{addon_attachment['id']}"
        ).body
      end
      action("Unsetting #{attachment_name} vars and restarting #{app}") do
        @status = api.get_release(app, 'current').body['name']
      end
    end
addons:detach ATTACHMENT_NAME

 detach add-on resource from an app