Skip to main content
compliance · gcp

Compute Engine instances with deletion protection turned off

resource types
1
rule IDs covered
1
severity
medium

What does ZopNight detect here?

ZopNight rule RC-148 flags standalone Compute Engine instances whose discoverer-confirmed deletionProtection flag is false. VMs inside managed instance groups, GKE node pools, or Dataproc clusters are skipped, because GCP forbids the flag there. One gcloud command fixes a finding; the rule abstains whenever the flag was never observed.

Signal and threshold

How ZopNight evaluates Compute Engine instances with deletion protection turned off.
Field Value
Rule IDsRC-148
Categorycompliance
Severitymedium
Metricnone — pure configuration read
Sourcevm_deletion_protection.go

The cheapest insurance in Compute Engine

Deletion protection is a single boolean on the instance. While it is on, every delete path (console, gcloud, Terraform, a scripted cleanup job) fails with an error until someone deliberately flips the flag off first. Turning it on costs nothing and takes one command:

Terminal window
gcloud compute instances update my-vm --zone us-central1-a --deletion-protection

The forced two-step delete is the whole point. Most accidental terminations are not malice; they are a wrong project in the active gcloud configuration, a stale Terraform state, or a cleanup script whose filter matched too broadly. The flag converts each of those from an outage into an error message.

What RC-148 reads before it fires

The GCP discoverer stamps the deletion_protection state into resource metadata in both polarities, so the rule can prove the condition rather than infer it: a finding is raised only on a confirmed false, and the rule abstains whenever the flag is absent or unparseable. An instance the discoverer never enriched produces no finding at all. Discovery runs read-only, under roles/cloudasset.viewer.

Managed group members are deliberately excluded

GCP refuses to set deletion protection on instances that belong to a managed instance group, which covers every GKE node and Dataproc worker. Those instances always surface with the flag false while also carrying a parent reference, and the rule skips anything whose parent field is populated. Without that gate it would raise an unactionable finding on every autoscaled node in the fleet. Standalone VMs, including members of unmanaged instance groups, are still evaluated, because the flag genuinely applies to them.

Check an instance yourself

Terminal window
gcloud compute instances describe my-vm --zone us-central1-a \
--format='value(deletionProtection)'

Before you rely on it

Two caveats. Deletion protection guards the instance object, not its data: attached disks can still be deleted or corrupted independently, so pair this control with a snapshot schedule on the disks. And plan the eventual teardown: decommissioning a protected VM is a two-step operation by design, so put the flag flip into the decommission runbook rather than discovering it mid change window.

See it fire on your bill.

Connect an account read-only. The first findings land in minutes.

417 rule families across 353 resource types on 22 platforms. Every threshold, metric, and IAM action is documented on these pages before you grant anything.

417 rule families documented
353 resource types covered
read-only default access level
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·