A single resource
The commands come out quoted, and the untargeted plan afterwards is part of the output
aws_instance.web
Build correctly quoted -target and -replace flags. Both narrow what Terraform does, and only one of them is meant for routine use.
Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.
The answer appears here
Paste on the left and press Build. Nothing leaves this tab.
Nothing else to flag.
No formatting problems, and nothing the rules object to. Worth remembering what that covers: this reads the file you pasted, not the account or cluster it will be applied to.
No finding matches that filter.
Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.
The commands come out quoted, and the untargeted plan afterwards is part of the output
aws_instance.web
Targets everything the module declares, which is rarely what narrowing meant
module.vpc
A sign the root module holds things with unrelated lifecycles
aws_instance.a aws_instance.b aws_instance.c aws_instance.d aws_instance.e aws_instance.f
These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.
Every targeted apply leaves the unnamed resources unreconciled, so drift accumulates invisibly and surfaces later as a large, surprising plan.
Instead:Use it to break a deadlock or recover from a failed apply, then run an untargeted plan and read it.
That marks state and hides the rest of the plan. -replace does the same job with a full plan you can review first.
Instead:Use terraform apply -replace='ADDRESS'.
A module address includes every resource inside it and their dependencies, which for most modules is not narrow at all.
Instead:Target the specific resource: module.vpc.aws_subnet.private.
Terraform prints a warning saying so. The reason it matters is not the run in front of you but the ones after it.
So the apply succeeds and the resources you did not name keep diverging from the configuration, with nothing looking at them. Used once to break a deadlock that is fine. Used every day, it hides drift indefinitely, and the drift is discovered by the first person who runs an untargeted plan.
-replace=ADDRESS plans a destroy and a create for that resource and leaves the rest of the plan intact, so you still see everything else. It replaced terraform taint, which marked state directly and gave you nothing to review first. If the goal is to recreate rather than to narrow, this is the flag.
A module address means every resource the module declares, plus their dependencies. For a module of any size that is most of the configuration, which defeats the point. Name the resource inside the module instead.
If a manageable plan requires naming six resources, the state holds things with unrelated lifecycles, and every person has to repeat the same flags. That is a root module that wants splitting, and the targeting is treating the symptom.
Brackets are glob characters, so zsh fails before Terraform runs and bash strips the quotes around a for_each key. Single quotes around the whole address are the fix, and the commands here already have them.
It is the only thing that tells you what the targeted run left behind. Reading it is the step that turns targeting from a habit into a tool.