Cleaning Out a Compartment on Oracle Cloud using Terraform provider

Lucas Jellema
Nov 25 · 5 min read

The situation: a Compartment on OCI should be removed. Or at least all its resources should be purged. Or at least most of the resources should be removed.

The challenge: there is no “purge compartment” available that will delete the resources in the compartment. Removing each resource one by one is quite a lot of work; it takes a long time and is very, very dull.

The solution: use the Terraform OCI provider to discover resources — then use Terraform to destroy all resources using the…