Terraform Drifts occur whenever there is a discrepancy between your desired configuration state (The Terraform Code) and your actual configuration state (Running configuration of the resource).
These drifts pose a security, compliance, and cost risk to your environment.
Just a few weeks ago we announced our Drift Source capability that helps to investigate who created the drift, but the main challenge we heard from our customers is the time it takes to actually remediate the drift.
They asked us if we could automate the entire Drift remediation process, and that is exactly what we did.
Starting today, we are enhancing our Drift Center’s capabilities and providing our users with the ability to remediate against Terraform Drifts, with One-click Drift Remediation.
This means that you can seamlessly resolve Terraform Drifts, directly from the ControlMonkey dashboard, saving your DevOps time and preventing unnecessary risks to your production environment.
ControlMonkey offers two methods to remediate Terraform Drifts:
Remediate with ‘Align Code’
In cases where you are certain that the running configuration is the right one, you can use this remediation action to align your Terraform code to what’s running in production.
Yes, that’s right, ControlMonkey is going to alter your existing code to match the resources’ actual state.
When you resolve the drift with the ‘Align Code’ option, ControlMonkey creates a new PR (Pull request) in your Git repository and provides a fix to your Terraform Code which is 100% validated.
ControlMonkey opens a new branch in your Git repository, and whenever the PR is ready, you get a
1-click link to view the new PR.
ControlMonkey also supports fixing the code when you’re using Terraform Modules. Say there’s a drift due to a variable in a module, ControlMonkey will sort it out by fixing the value of the variable that’s sent to the module:
As part of our Terraform CI/CD pipeline, whenever a new PR is created, we automatically start a ‘Terraform Plan’ to the branch of the stack. After the Terraform Plan is completed and the drift is resolved, you can then merge the PR to your main branch.
Remediate with ‘Reconcile’
In cases where you are certain that the Terraform code is the right configuration, you can use this remediation action which performs a ‘Terraform apply’.
When you resolve the drift with reconcile, ControlMonkey updates the resources’ configuration in production and overrides the running configuration to what’s configured in the code.
To summarize, ControlMonkey Drift Center is now the one-stop-shop to detect, investigate, and seamlessly remediate Terraform drifts.