I’d like to destroy (not delete) either a set of resources or a workspace managed on TF enterprise and linked to a VCS. In a cli-driven workflow, It’s enough to simply go to the appropriate directory in the hierarchy and issue from the command line:
$ terraform destroy
$ tarreform apply
How can I do that in with a (workspace + VCS) driven workflow ?
In the settings menu for the workspace there is a
Destruction and Deletion page that will let you queue a destroy plan.
If you have the TFE remote backend configured you can also run this locally via the usual
terraform destroy flow.
Both of the above require that you have
CONFIRM_DESTROY=1 set in the workspace (or you can manually enable it via that
Destruction and Deletion page.
A hackier option is to just push a commit with the resources removed.
Hi @tvon. Thanks for your comment. I knew about deleting from the UI. However I wanted to explore the possibility of running it from the terminal. It seems possible if your workspace is not fed with a VCS (github, gitlab, etc.). Otherwise, any modification has to come through the VCS to maintain it (the VCS) as the only source of truth.
Is there a way to queue the destroy plan using the API?