"Objects have changed outside of Terraform": what it means, how to find who touched the console and how to close the drift
You run terraform plan, nothing changed in the repo, and the plan comes back with "Note: Objects have changed outside of Terraform" and a list of resources marked "has been changed" or "has been deleted".
It is Terraform telling you that, while reading the real objects from the provider, it found something different from what it had recorded in state since the last apply. It is not an error: the command continues and the plan comes out anyway. The useful question is a different one: who changed it, and whether state has to absorb that change or the apply has to undo it.
What the message means
The terraform plan documentation describes three steps: read the current state of remote objects so that state is up to date, compare the configuration with that prior state, and propose the actions. The first step is the refresh, and the note comes from there.
Terraform always did it; what changed in 0.15.4 is that it started showing it in the plan result, because people did not understand where a change that no commit explained was coming from. The changelog of that version says it in those words: the note is information, it does not change behavior.
That is why a plan can show the note and end in "No changes": the drift exists, but it touches nothing the configuration declares, like a tag the code does not manage or a computed attribute the provider updated.
And there is a detail that confuses people: since 1.2.0 the normal plan shows the note only when the detected change relates to what the plan proposes. A clean "No changes" does not prove there is no drift. To see all of it you have to ask for it.
The three commands
# 1. see all the drift without proposing configuration changes
terraform plan -refresh-only -detailed-exitcode
# exit 0 = no differences, 1 = error, 2 = drift to write into state
# 2. accept the drift: writes what was detected into state, does not touch objects
terraform apply -refresh-only
# 3. undo the drift: the normal plan proposes going back to what the code says
terraform plan
terraform plan -refresh-only mode exists since 0.15.4 and the documentation presents it for when you changed objects by hand outside the workflow, for example while responding to an incident, and need to reconcile Terraform's records.
With -detailed-exitcode the plan returns 0 with an empty diff, 1 if it failed and 2 if there is a diff; in refresh-only, a 2 is drift pending to be written into state, and that fits in a cron or a CI job without parsing text.
terraform apply -refresh-only shows what it detected and asks for confirmation before writing state; terraform refresh does the same without asking and the documentation marks it as deprecated. The third command is the usual plan: if the code says one thing and the account another, the apply goes back to the code.
The -refresh=false option turns off synchronization with remote objects. The plan runs faster with fewer API calls, but the same page warns that it ignores external changes and can produce an incomplete or incorrect plan. It helps for a one-off run against a slow API; it does not help to stop seeing drift, because the drift stays and the apply will run into it.
Who touched the console
Terraform tells you what changed, not who. That lives in the provider's audit log, and the full procedure per cloud is in who created this resource: audit logs in AWS, Azure, GCP and OCI.
One command per cloud, with the id Terraform prints in the note:
# AWS: events from the last 90 days in the resource's region
aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=<id>
# Azure: --offset because without it the window is 6 hours
az monitor activity-log list --resource-id <arm-id> --offset 90d --select eventTimestamp caller operationName
# GCP: --freshness because by default it reads only the last day
gcloud logging read 'protoPayload.resourceName:"<name>"' --project=<project> --freshness=30d
# OCI: the time range is required
oci audit event list --compartment-id <ocid> --start-time 2026-11-01T00:00:00Z --end-time 2026-11-28T00:00:00Z --all
With the principal's name in hand, the conversation changes: instead of "someone touched production" it is "this account changed this security group on Tuesday at 16:40". If the principal is a service principal or an assumed role, whoever used it is in the session, not in the name.
What the drift plan cannot see at all
The refresh walks what is in state. A resource created by hand in the console has no address in state, so there is nothing to refresh and the note never names it.
That resource is invisible to plan -refresh-only until someone imports it or until an apply collides with it: a name that already exists, a CIDR that overlaps, a quota that ran out. That class of failure, the green plan followed by a red apply, is taken apart in what plan does not verify.
The drift note covers half the problem; the other half is comparing the whole account against what the code knows.
Frequently asked questions
Is "Objects have changed outside of Terraform" an error?
No. It is an informational note that comes out of the plan refresh; the plan continues and the apply can run. The 0.15.4 changelog says that by default it is information only and does not change behavior.
Does terraform apply -refresh-only modify the infrastructure?
No. It writes into state what it detected in the remote objects, with a confirmation first; the terraform refresh documentation describes it that way and recommends that form over the old command.
Why does the plan say "No changes" if someone changed something by hand?
Because since 1.2.0 the normal plan shows only the external changes related to what it proposes, and because a change in an attribute the code does not declare generates no action. plan -refresh-only shows everything it detected.
Sources
- HashiCorp, "terraform plan" (the three plan steps; -refresh-only since v0.15.4; -detailed-exitcode 0, 1 and 2; -refresh=false and the incomplete or incorrect plan).
- HashiCorp, "terraform refresh" (deprecated command; alias of
apply -refresh-only -auto-approve; -refresh-only introduced in v0.15.4). - HashiCorp, tutorial "Use refresh-only mode to sync Terraform state" (literal output of the "Objects have changed outside of Terraform" note).
- HashiCorp, Terraform CHANGELOG v0.15.4 (the note is information and does not change behavior) and v1.2.0 (the plan shows only external changes related to what it proposes).
- AWS CLI, cloudtrail lookup-events (AttributeKey ResourceName; 90 days). Azure CLI, az monitor activity-log list (--resource-id, --offset). gcloud, logging read (--freshness default 1d). OCI CLI, oci audit event list (--compartment-id, --start-time, --end-time).
- Control Cloud source code (
web/src/lib/preflight/,cloudmap/): inventory via API and pre-flight checks; no refresh and no state diff.
I write about infrastructure on the Control Cloud blog, where I work; the original version of this note is at https://controlcloud.dev/en/blog/terraform-objects-have-changed-outside-of-terraform-drift?utm_source=devto&utm_medium=referral&utm_campaign=devto-drift
This article was created with the help of AI and reviewed by the author.
Comments
No comments yet. Start the discussion.