Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.
To fix Terraform misconfigurations properly, change the Terraform code that created the resource, merge it through review, and let terraform apply push the corrected setting. Don't fix it by hand in the cloud console. A console fix makes the live resource disagree with its code, and the next apply can quietly put the misconfiguration back.
That's the whole rule. The rest of this guide is about how to follow it when you have hundreds of findings and no idea which repository owns which bucket.
When security teams talk to us about cloud findings, the same pattern comes up again and again. A public storage bucket gets flagged. Someone with console access flips it to private. The finding closes. Two weeks later, it's back.
The finding didn't come back because the fix was wrong. It came back because the fix was in the wrong place.
HashiCorp's tutorial on managing resource drift explains the mechanics. Terraform refreshes its state against real infrastructure on every plan and apply. If someone changed a resource outside Terraform, a normal plan or apply will try to revert that manual change to match the code. The tutorial warns this can even destroy or recreate resources unintentionally.
So the console fix and the code are now competing. The code wins on the next apply.
If the fix is that simple, why do teams keep fixing in the console?
Because a cloud finding names a resource, and the fix lives in a repository. A security engineer looking at an over-permissive IAM role in a production account usually has no fast way to answer three questions:
The console is right there, and the repository is a search across dozens of codebases. That's not a discipline problem. It's a missing map from resource to source.
Start with the resource identifier from the finding. Search your Terraform repositories for the resource name, tags or the module that provisions that type. Tag every resource with its repository and owner at creation time. It pays for itself the first time you need this step.
Before changing anything, run terraform plan -refresh-only in that workspace. HashiCorp recommends it for inspecting drift without making changes. If someone already "fixed" the resource in the console, you'll see it here.
Edit the resource or module argument that creates the misconfiguration. Prefer fixing the module over patching one call site, so every resource built from it is fixed at once.
Run terraform plan and read what it will change. A one-line change to a shared module can touch fifty resources. The plan is your blast radius.
Open a pull request, get it approved by the code owner, and apply it through CI. The finding closes because the source is fixed, not because someone clicked a toggle.
Add a policy check or scanner to the pull request pipeline so the same misconfiguration is caught before it's applied again.
| Console fix | Terraform code fix | |
|---|---|---|
| Time to close the finding | Minutes | Hours to days |
Survives the next terraform apply | No, it's reverted | Yes |
| Fixes every resource built from the module | No | Yes |
| Leaves an audit trail | Cloud logs only | Pull request, review and plan |
| Creates drift | Yes | No |
The point is not that the console is always wrong. For an actively exploited exposure, change the live setting first to stop the bleeding. Then make the code fix the same day, so the emergency change isn't reverted.
These are the cloud findings that most often recur after a console fix, because they're set in shared modules:
0.0.0.0/0 on admin or database ports.Each is usually one argument in one module, which makes it a good candidate for an automated, reviewable fix.
Nullify's Cloud Security audits AWS, GCP, Azure and Kubernetes continuously, triggered when the environment changes rather than on a schedule. Each finding is traced back to the source repository that created the resource, and owners come from CODEOWNERS. That's the resource-to-source map most teams are missing.
From there, Autofix can treat a triaged cloud misconfiguration like a code vulnerability: plan a minimal change in the infrastructure as code, run it through an independent review, run the checks the workflow has, and open a draft PR for the owner to approve. It works the PR through CI and review and never merges on its own. Nullify scans Terraform, CloudFormation and Kubernetes manifests.
One honest limit: deep asset-graph analysis covers AWS and GCP. Azure is audit-level only.
Drift is when real infrastructure no longer matches the Terraform configuration and state that describe it, usually because someone changed a resource outside Terraform. You can see it with terraform plan -refresh-only. A normal apply will try to revert the manual change to match the code.
In Terraform. A console fix creates drift and can be reverted on the next apply. The exception is an active incident: change the live setting first to contain it, then make the matching code change the same day.
Search your infrastructure repositories for the resource name, tags or module, and check state files for the resource address. Tagging every resource with its repository and owner at creation time makes this a lookup instead of a search. Some cloud security tools trace findings to their source repository automatically.
Yes, when the fix is made in infrastructure as code and reviewed like any other change. An automated fix should change the module or resource argument, show the plan's impact, and go through the owner's pull request review rather than editing live infrastructure directly.