-target
The plan, apply and destroy option that limits the run to one resource or module and whatever it depends on.
Partial applies leave the rest of the configuration out of step with reality without telling you.
In more detail
It is meant for recovering from mistakes, not routine work. Using it regularly leaves other resources out of date and hides drift, and Terraform warns every time you use it.
Example
terraform destroy -target=local_file.greetingRelated terms
- terraform plan — The command that compares configuration, state and reality and prints the actions needed to make them match, without changing anything.
- terraform destroy — The command that deletes every resource the current state records, in reverse dependency order.
- configuration drift — The slow, unrecorded way machines end up with different versions and settings from each other.
Taught in
- Tearing It Down With Destroy — Infrastructure as Code with Terraform
- Validate, Format, Destroy, And The Flags That Bend A Plan — HashiCorp Terraform Associate (004) Exam Prep
- Dependencies, depends_on And Lifecycle Rules — HashiCorp Terraform Associate (004) Exam Prep
- Drift: When Reality Stops Matching State — HashiCorp Terraform Associate (004) Exam Prep
- Inspecting And Repairing State From The CLI — HashiCorp Terraform Associate (004) Exam Prep
- Trap Sprint: Twelve Answers That Are Almost True — HashiCorp Terraform Associate (004) Exam Prep