DevOpsprompt onlyMedium

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.

← all loops
DevOpsTerraformInfrastructureDrift DetectionAutomation

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.

  1. 01

    Step 1: Initialize Environment

    Set up the working directory with Terraform configurations and ensure necessary credentials are available.

  2. 02

    Step 2: Execute Loop Prompt

    Trigger the loop in your agent with the provided kickoff prompt.

  3. 03

    Step 3: Monitor Progress

    Observe the agent's actions and inspect Terraform plan outputs for any drift resolution.

  4. 04

    Step 4: Validate Resolution

    Confirm that the exit condition (clean Terraform plan) is met before stopping the loop.

Workflow Steps

  1. 01

    Analyze current infrastructure state against Terraform configurations.

  2. 02

    Generate and review Terraform plan to identify drift.

  3. 03

    Apply corrective changes if drift is detected.

  4. 04

    Re-check infrastructure state to verify resolution.

  5. 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

rendering…

Related loops — DevOps