Google Cloud Delete

Google Cloud Delete

Certified

Delete a Compute Engine instance

Deletes a Compute Engine instance and, by default, waits for the deletion to complete. Boot disks created with the instance are removed along with it; additional disks attached separately are kept unless they were created with auto-delete enabled.

yaml
type: io.kestra.plugin.gcp.compute.Delete

Delete an instance when a flow completes.

yaml
id: compute_engine_cleanup
namespace: company.team

triggers:
  - id: on_flow_completion
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatusCondition
        in:
          - SUCCESS
          - FAILED

tasks:
  - id: delete_instance
    type: io.kestra.plugin.gcp.compute.Delete
    serviceAccount: "{{ secret('GCP_SERVICE_ACCOUNT_KEY') }}"
    projectId: "{{ secret('GCP_PROJECT_ID') }}"
    zone: "us-central1-a"
    instanceName: "kestra-job-{{ trigger.executionId }}"
    waitUntilDeleted: "true"
Properties

The name of the Compute Engine instance

The zone where the instance is located

e.g. us-central1-a.

The GCP service account to impersonate

Reference (ref) of the pluginDefaults to apply to this task.

The GCP project ID

SubTypestring
Default["https://www.googleapis.com/auth/cloud-platform"]

The GCP scopes to be used

The GCP service account

DefaultPT10M

The maximum duration to wait for the operation to complete

Default: PT10M. Hitting this timeout fails the task but does not cancel the in-flight GCP operation.

Defaulttrue

Whether to wait for the instance to be fully deleted before completing the task

Default: true.

The unique GCP instance ID of the deleted instance, if it could be resolved before deletion

The name of the deleted instance

The instance status after the operation

DELETED if the deletion completed, PENDING_DELETE if waitUntilDeleted is false.