Interview Prep/Terraform/Workflow and Providers

When is `-target` acceptable, and when is it a red flag?

IntermediateScenarioWorkflow and Providers
Answer

Situation read → An engineer wants to apply one resource to "save time".

What I'd do →

  1. Allow it for recovery, such as fixing a broken dependency or getting past an error to unblock the graph.
  2. Follow every targeted apply with a full terraform plan that must converge to no changes.
  3. Refuse it as a routine workflow or in pipelines.
terraform apply -target=aws_iam_role.deploy
terraform plan   # must be clean afterwards

Why → Terraform itself warns that targeting is for exceptional situations; it skips parts of the graph, so outputs and dependent resources can go stale.

Interview tip → Offer the real fix for slow plans: smaller states.

All Terraform questions Roadmap: Terraform

More on Workflow and Providers