> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/resilience-testing/chaos-engineering/faults/chaos-fault-categories/gcp/gcp.md).

# Chaos faults for GCP

### Introduction <a href="#introduction" id="introduction"></a>

GCP faults disrupt resources that run on Google Cloud Platform: Compute Engine VM instances, persistent disks, and managed Cloud SQL instances. Each fault calls the GCP API (using a service account JSON key uploaded as a File Secret in Harness Secret Manager, or Workload Identity on GKE) to inject the disruption, then reverses it cleanly at the end of the configured duration. Go to [Authentication options](/resilience-testing/chaos-engineering/faults/chaos-fault-categories/gcp/security-configurations/prepare-secret-for-gcp.md) to set up credentials, and [GCP IAM integration](/resilience-testing/chaos-engineering/faults/chaos-fault-categories/gcp/security-configurations/gcp-iam-integration.md) to use Workload Identity.

<table data-view="cards"><thead><tr><th></th><th></th><th><select multiple><option value="nl0F4WNu" label="instance" color="blue"></option><option value="i-5T4-dw" label="failover" color="blue"></option><option value="KZ7vo3d3" label="disk loss" color="blue"></option><option value="--WFG5TA" label="instance stop" color="blue"></option></select></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>GCP SQL instance failover</strong></td><td>Trigger a failover on a high-availability Cloud SQL instance so you can test how the application behaves when the primary node fails over to its standby.</td><td><span data-option="nl0F4WNu">instance, </span><span data-option="i-5T4-dw">failover</span></td><td><a href="#gcp-sql-instance-failover">#gcp-sql-instance-failover</a></td></tr><tr><td><strong>GCP VM disk loss by label</strong></td><td>Detach a percentage of non-boot persistent disks selected by label from GCP VM instances for a configurable duration, then reattach them.</td><td><span data-option="KZ7vo3d3">disk loss</span></td><td><a href="#gcp-vm-disk-loss-by-label">#gcp-vm-disk-loss-by-label</a></td></tr><tr><td><strong>GCP VM disk loss</strong></td><td>Detach one or more named non-boot persistent disks from GCP VM instances for a configurable duration, then reattach them.</td><td><span data-option="KZ7vo3d3">disk loss</span></td><td><a href="#gcp-vm-disk-loss">#gcp-vm-disk-loss</a></td></tr><tr><td><strong>GCP VM instance stop by label</strong></td><td>Stop a percentage of Compute Engine VMs selected by label for a configurable duration, then start them again (or rely on the MIG auto-healer).</td><td><span data-option="--WFG5TA">instance stop</span></td><td><a href="#gcp-vm-instance-stop-by-label">#gcp-vm-instance-stop-by-label</a></td></tr><tr><td><strong>GCP VM instance stop</strong></td><td>Stop one or more named Compute Engine VMs for a configurable duration, then start them again (or rely on the MIG auto-healer).</td><td><span data-option="--WFG5TA">instance stop</span></td><td><a href="#gcp-vm-instance-stop">#gcp-vm-instance-stop</a></td></tr></tbody></table>

#### GCP SQL Instance Failover <a href="#gcp-sql-instance-failover" id="gcp-sql-instance-failover"></a>

GCP SQL instance failover triggers a failover on a high-availability Cloud SQL instance (`SQL_INSTANCE_NAME` in `GCP_PROJECT_ID`). The standby node becomes the new primary; the original primary becomes the new standby once the failover completes.

<details>

<summary>Use cases</summary>

* Test that application connection pools reconnect cleanly when the primary fails over.
* Validate that in-flight transactions surface clean rollback errors rather than data corruption.
* Confirm the failover time (typically 30-90s for Cloud SQL HA) fits the application's SLO.

</details>

<a href="/resilience-testing/chaos-engineering/faults/chaos-fault-categories/gcp/gcp-sql-instance-failover.md" class="button primary">View details</a>

#### GCP VM disk loss <a href="#gcp-vm-disk-loss" id="gcp-vm-disk-loss"></a>

GCP VM disk loss detaches one or more named non-boot persistent disks (`DISK_VOLUME_NAMES` in `ZONES`/`GCP_PROJECT_ID`) from their attached VMs for `TOTAL_CHAOS_DURATION` seconds, then reattaches them on the same device path. Boot disks are excluded by design.

<details>

<summary>Use cases</summary>

* Test how a stateful workload (Postgres, MySQL, Cassandra) handles a brief storage outage.
* Validate that filesystems remount cleanly when the disk returns.
* Confirm DR snapshot strategies cover sudden volume loss.

</details>

<a href="/resilience-testing/chaos-engineering/faults/chaos-fault-categories/gcp/gcp-vm-disk-loss.md" class="button primary">View details</a>

#### GCP VM disk loss by label <a href="#gcp-vm-disk-loss-by-label" id="gcp-vm-disk-loss-by-label"></a>

GCP VM disk loss by label resolves the set of non-boot persistent disks matching `DISK_VOLUME_LABEL` in `ZONES`/`GCP_PROJECT_ID`, picks `DISK_AFFECTED_PERCENTAGE` of them, detaches them from their attached VMs for `TOTAL_CHAOS_DURATION` seconds, then reattaches them.

<details>

<summary>Use cases</summary>

* Test how replicated stateful workloads survive losing a tagged subset of storage.
* Validate DR procedures for losing a labeled subset of disks across zones.

</details>

<a href="/resilience-testing/chaos-engineering/faults/chaos-fault-categories/gcp/gcp-vm-disk-loss-by-label.md" class="button primary">View details</a>

#### GCP VM instance stop <a href="#gcp-vm-instance-stop" id="gcp-vm-instance-stop"></a>

GCP VM instance stop stops one or more Compute Engine VMs listed in `VM_INSTANCE_NAMES` (in `ZONES`/`GCP_PROJECT_ID`) for `TOTAL_CHAOS_DURATION` seconds, then starts them again. With `MANAGED_INSTANCE_GROUP=enable`, recovery is driven by the MIG auto-healer.

<details>

<summary>Use cases</summary>

* Validate that managed instance groups recreate VMs inside the alerting SLA.
* Test GKE node-down handling when a worker VM disappears.
* Confirm that clients connected to stopped VMs fail over to surviving instances cleanly.

</details>

<a href="/resilience-testing/chaos-engineering/faults/chaos-fault-categories/gcp/gcp-vm-instance-stop.md" class="button primary">View details</a>

#### GCP VM instance stop by label <a href="#gcp-vm-instance-stop-by-label" id="gcp-vm-instance-stop-by-label"></a>

GCP VM instance stop by label resolves Compute Engine VMs matching `INSTANCE_LABEL` in `ZONES`/`GCP_PROJECT_ID`, picks `INSTANCE_AFFECTED_PERCENTAGE` of them, stops them for `TOTAL_CHAOS_DURATION` seconds, then starts them again (unless `MANAGED_INSTANCE_GROUP=enable`).

<details>

<summary>Use cases</summary>

* Test how the workload survives losing a tagged subset of VMs across zones.
* Validate cluster-level resilience when multiple labeled VMs disappear at once.

</details>

<a href="/resilience-testing/chaos-engineering/faults/chaos-fault-categories/gcp/gcp-vm-instance-stop-by-label.md" class="button primary">View details</a>

{% @harness-feedback/feedback %}
