New to Kestra?
Use blueprints to kickstart your first workflows.
React to a license deletion by purging dependent VM assets from the Kestra catalog. Flow trigger chains cleanups, webhook allows on-demand runs from monitoring.
When a software license is revoked or deleted, the machines provisioned against it become compliance liabilities that usually linger in inventories for months. This blueprint closes that gap: it purges io.kestra.plugin.ee.assets.VM assets whose metadata references a deleted license, keeping the Kestra asset catalog honest. It runs in two ways, automatically as a downstream reaction to a license deletion flow, or on demand through a secured webhook that a monitoring tool can call.
license input is a dynamic SELECT whose expression lists all io.kestra.plugin.ee.assets.VM.License asset ids via the assets() function and jq('.[].id'), so manual runs pick from real catalog entries.on_license_deletion trigger (io.kestra.plugin.core.trigger.Flow) uses preconditions to fire whenever the delete_license flow in company.team finishes in SUCCESS, mapping {{ trigger.outputs.licenseId }} into the license input. Flow chaining without hardcoded couplings.webhook trigger (io.kestra.plugin.core.trigger.Webhook) offers an HTTP entry point, secured with the CLEANUP_WEBHOOK_KEY secret, for tools like Dynatrace to request cleanups.purge_dependent_vms task (io.kestra.plugin.kestra.ee.assets.PurgeAssets) deletes VM assets matching two conditions: an endDate of {{ now() | dateAdd(-90, 'DAYS') }} so only assets older than 90 days are touched, and a metadataQuery requiring licenseId to EQUAL_TO the given license. allowFailure: true keeps a partial purge from failing the whole run.License systems and hypervisors do not talk to each other, so revocations rarely propagate to inventories. Kestra's Flow trigger turns the license deletion itself into the event that drives cleanup, with preconditions scoping it to exactly the right upstream flow and state. The PurgeAssets task then operates on the catalog with typed filters and metadata queries instead of custom scripts, and every run is logged, retryable, and auditable.
licenseId metadata field, for example by extending the asset-create-vm-with-license blueprint.delete_license flow in the company.team namespace that outputs licenseId, or use the webhook and manual execution paths only.CLEANUP_WEBHOOK_KEY: shared secret guarding the Webhook trigger so only authorized callers can start a purge.CLEANUP_WEBHOOK_KEY secret to your Kestra instance.company.team namespace.delete_license flow so the Flow trigger chains automatically.endDate window to match your compliance policy.Pause approval step before purging in regulated environments.assetType to also purge dependent snapshots, IPs, or certificates.