Infrastructure Drift Repair
This loop detects and repairs infrastructure drift by continuously comparing the current state with the desired state defined in Terraform configurations. It automatically applies necessary changes to ensure alignment while adhering to safety guardrails.
Goal
Match infrastructure desired state
How to Run
Run this loop in your preferred coding agent environment to automatically detect and fix infrastructure drift using Terraform.
- 01
Step 1: Initialize Environment
Set up the working directory with Terraform configurations and ensure necessary credentials are available.
- 02
Step 2: Execute Loop Prompt
Trigger the loop in your agent with the provided kickoff prompt.
- 03
Step 3: Monitor Progress
Observe the agent's actions and inspect Terraform plan outputs for any drift resolution.
- 04
Step 4: Validate Resolution
Confirm that the exit condition (clean Terraform plan) is met before stopping the loop.
Workflow Steps
- 01
Analyze current infrastructure state against Terraform configurations.
- 02
Generate and review Terraform plan to identify drift.
- 03
Apply corrective changes if drift is detected.
- 04
Re-check infrastructure state to verify resolution.
- 05
Exit loop if no drift remains or max iterations reached.
Kickoff Prompt
Start the "Infrastructure Drift Repair" loop. Goal: Match infrastructure desired state Max iterations: 10 Between iterations run: terraform plan Exit when: Terraform plan clean Start the Infrastructure Drift Repair loop. Continuously check for drift using 'terraform plan' and apply fixes until a clean plan is achieved or 10 iterations are completed. Ensure all actions are safe and do not modify critical resources without approval. Self-pace this loop. After each iteration, run `terraform plan` and evaluate the output, and only continue if the exit condition is not met (Terraform plan clean). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Only apply changes that are non-destructive and safe.
- ·Avoid modifications to critical production resources without explicit approval.
- ·Ensure the Terraform plan does not contain errors before proceeding.
- ·Create a backup of the current state before applying any changes.
Flow Diagram
Related loops — DevOps
DevOps
Container Security Fixer
Automatically detects and remediates security vulnerabilities in container images through iterative scanning and patching workflows.
DevOps
Monitoring Coverage Builder
This loop iteratively identifies and adds missing monitoring coverage to your codebase by analyzing test coverage, identifying gaps, and implementing targeted monitoring solutions until the desired threshold is achieved.
DevOps
Service Reliability Loop
This loop enables continuous improvement of service reliability and uptime by leveraging Service Level Objective (SLO) reports to identify and address performance gaps.