> For the complete documentation index, see [llms.txt](https://docs.firefly.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.firefly.ai/detailed-guides/workflows/periodic-plan-drift-detection.md).

# Periodic Plan Drift Detection

A periodic plan runs `plan` on a workspace automatically on a schedule, for example every 12 hours. If someone changed the infrastructure outside of code, the plan finds the difference and Firefly shows exactly what drifted, attribute by attribute.

Periodic plan drift detection works with **any provider**. If Terraform or OpenTofu can plan a resource, Firefly can detect drift on it. It works alongside the drift detection in the [Cloud Asset Inventory](https://docs.firefly.ai/detailed-guides/cloud-asset-inventory/remediating-drifts.md), which compares your codified assets with the live state of your connected data sources.

> **Related Guides:**
>
> * [Creating Workflows](https://docs.firefly.ai/detailed-guides/workflows/creating-workflows.md): Create a workspace and set its execution options, including the periodic plan.
> * [Drift Detection & Remediation](https://docs.firefly.ai/key-features/drift-detection.md): How Firefly detects and remediates drift across your infrastructure.

***

## Availability

Periodic plans are available for workspaces that Firefly orchestrates:

* Workspaces on **Firefly Runners**.
* Workspaces on [**Self-Hosted Runners**](https://docs.firefly.ai/detailed-guides/workflows/creating-self-hosted-runner.md).

Periodic plans aren't available for workspaces that [integrate into an existing CI/CD pipeline](https://docs.firefly.ai/integrations/workflows.md) (Bring Your Own Pipeline), because Firefly doesn't run those plans.

***

## Setting a Periodic Plan

You set the periodic plan in the workspace's execution settings, either when you [create the workspace](https://docs.firefly.ai/detailed-guides/workflows/creating-workflows.md) or later from **Edit Workspace**.

1. In the workspace wizard, go to the execution settings.
2. Select **Trigger plan periodically**.
3. In **Run plan every:**, choose an interval: **72**, **48**, **24** or **12** hours. The default is 72 hours.
4. Save the workspace.

When a workspace has a periodic plan, its header shows the schedule, for example **Periodic plan · every 12 hours**, along with when the next run is due.

To stop the scheduled runs, edit the workspace and clear **Trigger plan periodically**.

***

## Reading the Results

Each scheduled run appears in the workspace's run history with **Triggered by: Periodic plan**.

The run ends in one of these outcomes:

| Outcome                             | Meaning                                                                        |
| ----------------------------------- | ------------------------------------------------------------------------------ |
| **PLAN COMPLETED**                  | The plan found no drift. The live infrastructure matches the code.             |
| **PLAN COMPLETED · DRIFT DETECTED** | The plan found resources that were changed outside Terraform or OpenTofu.      |
| **PLAN FAILED**                     | The plan couldn't complete. Open the run to see the logs for the failing step. |

### The Drift Banner

When drift is detected, the run's **Overview** shows a banner that says how many resources changed, for example **2 resources changed outside Terraform**. The drift is found during the plan's refresh.

> **Warning:** Applying a plan that contains drift reverts the live values to what's in code. Before you apply, decide whether to keep the live change by updating your code, or to revert it.

### Viewing the Drift

Click **View drift** in the banner to open the **Drift detected** panel. For every drifted resource, the panel compares each changed attribute side by side:

* **Attribute**: The resource attribute that changed.
* **In code**: The value declared in your IaC.
* **Live**: The value in the cloud.

An attribute shows **(removed)** or **(not set)** when it has no value on one side. A resource that was created or deleted outside Terraform or OpenTofu has no attribute changes to compare, and the panel says so.

To focus on one kind of resource, filter the list by resource type. Select **All** to see every drifted resource again.

**Example:** A team member disables a GCP firewall rule in the Google Cloud console and removes its `10.0.0.0/8` source range. On the next periodic plan, the run ends with **PLAN COMPLETED · DRIFT DETECTED**. In the **Drift detected** panel, the `google_compute_firewall` resource lists the `disabled` and `source_ranges` attributes, with the values **In code** next to the **Live** values.

***

## Drift Notifications

You can get alerted the moment a periodic plan finds drift, without checking Firefly. In **Notifications**, create a notification (see [Notification Integrations](https://docs.firefly.ai/integrations/notifications.md)) with:

* **Event type:** `Workspace Run`
* **Workspace Status:** `PLAN COMPLETED · DRIFT DETECTED`
* Optionally, narrow it by **Workspaces**, **Repositories** or **Workspace Labels** — for example, alert the production team only on drift in production workspaces.

The alert includes the drift itself, not just a link:

* A header with the number of drifted resources and the workspace, for example *Drift detected · 3 resources · Workspace prod-network*.
* For each drifted resource, the attribute, its value **in code** and its **live** value.
* A warning that applying the plan sets the live values back to the values in code.
* An **Open in Firefly** button that goes straight to the run.

Each specific drift triggers the alert only once.

***

## Limitations

* Drift is detected only on periodic plan runs. Runs that you start manually or that a pull request triggers don't show the drift status or the drift details, even if the infrastructure has drifted.
* Drift found by a periodic plan doesn't yet create an event in the [Event Center](https://docs.firefly.ai/detailed-guides/event-center.md). Use [drift notifications](#drift-notifications) or the workspace's run history to see the results.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.firefly.ai/detailed-guides/workflows/periodic-plan-drift-detection.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
