Skip to content


Drift detection in Terrateam runs a plan operation against all dirspaces in a repository. If changes are found, a GitHub Issue in the repository is automatically created. Reconciliation can optionally be enabled to automatically apply the changes.


Drift detection is configured in the .terrateam/config.yml file under the drift key. Here’s the default configuration:

enabled: false
reconcile: false

Drift options

The drift section has the following options:

enabledBooleanSpecifies whether drift detection is enabled. If set to false, drift detection and reconciliation will not run. Default is false.
scheduleStringThe interval to run drift detection and reconciliation: hourly, daily, weekly, monthly.
reconcileBooleanSpecifies whether reconciliation is enabled. Default is false.
tag_queryStringLimit which directories are run with a tag query. Default is "".


Enabling drift detection

enabled: true
schedule: daily

This configuration will enable drift detection and run it on a daily schedule.

Enabling drift detection with reconciliation

enabled: true
reconcile: true
schedule: weekly

This configuration will enable drift detection with automatic reconciliation and run it on a weekly schedule.

Limiting drift detection to specific directories

enabled: true
schedule: hourly
tag_query: "dir:production"

This configuration will enable drift detection, run it on an hourly schedule, and limit it to directories tagged with dir:production.


The schedule key can be set to one of the following values:

  • hourly
  • daily
  • weekly
  • monthly

There is no default value for schedule, and this key is required when drift detection is enabled.


The reconcile key enables or disables automatic reconciliation. When enabled, if changes are found during drift detection, an apply operation will automatically run against the generated Terraform plan to reconcile the infrastructure state.


GitHub Issues

If changes are found during drift detection, a GitHub Issue can be automatically created by adding the following configuration:

- type: drift_create_issue

Duplicate issues for identical changes will not be created. GitHub Issue Drift Detected


You can create Slack notifications using the official GitHub integration for Slack:

  1. Install the app in your desired Slack workspace and channel.
  2. Use the /github command to subscribe to your Terraform repository:
    /github subscribe owner/repo issues

Custom notifications

To create custom notifications or actions when drift detection finds changes, you can implement a custom hook using the Terrateam configuration file.


- type: run # run on every drift run with changes
cmd: ['bash', '-c', '$TERRATEAM_ROOT/']

Example notification script

#!/usr/bin/env bash
set -e
if [[ "$TERRATEAM_RUN_KIND" == "drift" ]] && [[ -f "$TERRATEAM_RESULTS_FILE" ]]; then


When configuring drift detection in your Terrateam configuration, keep the following in mind:

  • Drift detection operations are equivalent to plan operations. Existing workflows and hooks run for all drift detection operations.
  • The following environment variable is defined for plan and apply operations initiated by drift detection:
  • If reconciliation is enabled, changes will be automatically applied without manual review or approval. Ensure that you have appropriate safeguards and testing in place before enabling automatic reconciliation.
  • Drift detection can generate a significant number of GitHub Issues if changes are frequently detected. Consider using appropriate filters, such as the tag_query option, to limit the scope of drift detection and reduce noise.
  • Custom notifications and actions can be implemented using hooks and scripts to integrate drift detection with your existing monitoring and alerting systems.
We use cookies and similar technologies to provide certain features, enhance the user experience and deliver content that is relevant to your interests. Depending on their purpose, analysis and marketing cookies may be used in addition to technically necessary cookies. By clicking on "Agree and continue", you declare your consent to the use of the aforementioned cookies. Here you can make detailed settings or revoke your consent (in part if necessary) with effect for the future. For further information, please refer to our Privacy Policy .