coder / coder/terraform-provider-coder

Add `run_on_destroy` to `coder_script`

Open
#341 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
60
Forks
27
Avg merge
1d 21h
Merged PRs (30d)
2

Description

While there `run_on_start` and `run_on_stop` form a nice balance, some `run_on_start` scripts are actually meant to be balanced against a `run_on_destroy` trigger. As an example, using the `run_on_start` scripts to do a `git clone` of packages for the workspace, you naturally would not want to delete those when the workspace is stopped, however you might want to delete them when the workspace is destroyed.

A `git clone` is of course not a perfect example as we have terraform modules to do that for us already, and furthermore most providers are relying upon the containerization/virtualization provider to do cleanup when workspaces are destroyed, but if there are persistent resources being managed by `coder_script` snippets, it would be incredibly handy to have a `run_on_destroy` trigger to manage their lifecycles properly.

In my case, this is because I am using Coder to provide access directly to machines that have already been provisioned, and I use `remote-exec` to SSH into the devices and install the `coder` agent, then `coder_script` snippets to set up all kinds of state. I would like to clean that up properly upon workspace destruction.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.