Why would you use the -replace flag for terraform apply?
A.
You want to force Terraform to destroy a resource on the next apply.
B.
You want Terraform to ignore a resource on the next apply.
C.
You want to force Terraform to destroy and recreate a resource on the next apply.
D.
You want Terraform to destroy all the infrastructure in your workspace.
The Answer Is:
C
This question includes an explanation.
Explanation:
Rationale for Correct Answer: terraform apply -replace=ADDRESS forces Terraform to replace the specified resource during the next apply, meaning it will plan to destroy and then recreate it (or create-before-destroy if the resource supports it and the graph/lifecycle allows). This is used when a resource is unhealthy, drifted in a way that’s hard to correct, or you want a fresh instance without changing configuration.
Analysis of Incorrect Options (Distractors):
A: Incorrect—-replace is not “destroy only”; it’s destroy + recreate.
B: Incorrect—ignoring changes is done with lifecycle ignore_changes, not -replace.
D: Incorrect—destroying everything is terraform destroy (or apply with all resources removed), not -replace.
Key Concept: Forcing resource replacement using -replace in the apply workflow.
[Reference: Terraform Objectives — Manage Terraform Resources and Providers (resource lifecycle and change actions), Understand Terraform Basics and CLI (apply flags)., , ]
Terraform-Associate-004 PDF/Engine
Printable Format
Value of Money
100% Pass Assurance
Verified Answers
Researched by Industry Experts
Based on Real Exams Scenarios
100% Real Questions
Get 65% Discount on All Products,
Use Coupon: "ac4s65"