IaCM Remediation Agent
Use the IaCM Remediation Agent to generate pull requests with recommended IaC changes for drift insights.
When Harness IaCM detects that a resource has drifted from your OpenTofu or Terraform configuration, the Remediation Agent helps you close that gap. It analyzes the drift insight and generates a pull request with recommended configuration changes, which you launch from the Insights tab of a workspace.
The agent does not change your infrastructure directly. It generates a pull request so you can review the proposed changes before they become part of your IaC configuration, which keeps your Git repository the source of truth.
How remediation works
Remediation runs on the project's default remediation pipeline. You configure this pipeline once for the project in the IaCM Defaults, and it then applies to every workspace in the project. Harness does not remediate drift automatically; you start each remediation from an insight. From detection to a merged fix, the flow is:
Harness IaCM detects a drift insight for a resource in your workspace.
You click Apply with agent on the Insights tab.
Harness runs the project's default remediation pipeline, which contains a single Remediation Agent step.
The agent generates a pull request with recommended IaC changes for the drifted resource.
You review and merge the pull request, then provision the workspace to apply the change.
Before you begin
Before you launch remediation, confirm the following are in place:
A workspace with an open drift insight: Drift insights appear on the Insights tab. Go to Drift detection to configure drift detection.
A default remediation pipeline: Configure the remediation pipeline for the project in the IaCM Defaults. Go to Default pipelines to review how defaults are configured.
Permission to run the pipeline and merge the pull request: Execute permission on the remediation pipeline and write access to the connected repository. Go to Workspace RBAC to review IaCM permissions.
Remediate an insight
Once drift appears as an insight, you remediate it from the Insights tab in a few steps.
Navigate to your workspace and select the Insights tab.
Locate the open insight you want to remediate, then click Apply with agent.

Apply with agent button on a drifted resource In the Run Pipeline panel, confirm the workspace, then click Run Pipeline.

Run Pipeline panel for the remediation agent When the pipeline completes, open the execution output and click the pull request link.
Review the proposed changes in your repository, then merge the pull request to bring the resource back in line with your configuration.
The insight moves from Open to Applied once the remediation pipeline generates the pull request, so Applied means a fix has been proposed, not that your infrastructure has changed yet.
Cloud Cost Management recommendations
Drift is not the only insight the agent can act on. If Cloud Cost Management is connected to the workspace, the agent also folds in applicable cost recommendations when it generates the pull request. To connect it, go to Workspace Overview and enable the Cloud Cost Management Integration toggle for your workspace.
Troubleshoot remediation
If remediation does not behave as expected, the following cases cover the most common causes.
Next steps
With remediation configured, you can act on drift as soon as it surfaces.
Go to Insights to review the insights you can remediate.
Go to Drift detection to understand how Harness IaCM detects drift.
Go to Default pipelines to configure the remediation pipeline for your project.
Last updated
Was this helpful?