How to Clean Up Expired Resources
A resource can be tagged with an expiration tag that instructs Resoto to clean it up after it has reached a certain age. This can serve as a safety net for when a CI job fails or the IaC tool aborts halfway through its run, or even as the primary means of managing resource lifecycles.
cleanup_expired plugin can find and delete expired resources.
> config edit resoto.worker
Enable cleanup by modifying the
resotoworkersection of the configuration as follows:
# Enable cleanup of resources
# Do not actually cleanup resources, just create log messages
# How many cleanup threads to run in parallel
When cleanup is enabled, marked resources will be deleted as a part of the
collect_and_cleanupworkflow, which runs each hour by default.tip
trueto simulate cleanup without actually deleting resources.
plugin_cleanup_expiredsection, setting the
true:cleanup_expired plugin configuration
# Enable plugin?
The plugin will now run each time Resoto emits the
cleanup_plan event. The
cleanup_plan event is a part of the
cleanup workflows and emitted after resource collection is complete but before the cleanup is performed.
Each time the
cleanup_expired plugin runs, expired resources will be flagged for removal during the next cleanup run.
A resource's expiration time can be defined either with an ISO 8601 timestamp or time delta:
|ISO 8601 timestamp|
|Time delta from resource creation time|
Please see the Resource Expiration for more information about expiration tags.