Destroy resource after run

Hi Guys.

Is there any way, or args, to destroy a resource after it has performed a task?

for example:

I created a machine and ran a script, when I finish, I want to destroy it.

Thanks!!
Regards!