Drift Detector

👍

Drift detection runs do NOT count toward billing.

Overview

Drift detection in Terraform or OpenTofu is a feature that helps identify when your actual infrastructure state has deviated ("drifted") from the desired state defined in your configuration.

In Scalr, drift detection can be enabled per environment. If enabled per environment, all workspaces in the environment will have the detection schedule applied.

To enable it, go to the environment management settings, click on drift detection, and apply the schedule:

Once enabled, the drift detector will execute based on the schedule. If drift is detected, workspace owners will see the drifted run in the drift detection tab. Drift detection runs do not block the run queue if drift is found and waiting on your decision (Sync state or revert infrastructure).

Drift will execute if the workspace has the following:

  • The workspace has active state.
  • A workspace has not been applied during the configured period: daily - in the last 24 hours, weekly - in the last 7 days.
  • Remote execution is mode enabled.

Resolving Drift

Scalr will not resolve drift automatically. Instead, users should execute a new run to resolve it. To resolve drift, a Plan & Apply or Refresh-Only run can be executed:

  • Plan & Apply: The infrastructure will be reverted back to the desired state in the Terraform configuration files.
  • Refresh-Only: The Terraform/OpenTofu state file will be updated to match the current state of infrastructure.