To apply changes only to a subset of resources, which approach is appropriate?

Prepare for the HashiCorp Terraform Associate Exam. Utilize flashcards and multiple-choice questions with detailed hints and explanations. Boost your confidence and be ready for success!

Multiple Choice

To apply changes only to a subset of resources, which approach is appropriate?

Explanation:
When you want to update only a specific part of your infrastructure, limit Terraform’s action to that resource using the -target option with the apply command. This focuses the plan and the changes on the chosen resource and any resources that depend on it, allowing you to apply just those updates without touching the rest of your configuration. Running a plan without a target would generate changes for all managed resources, not a subset. Removing other resources from the config is not a safe or practical way to isolate changes, and formatting the code doesn’t apply any infrastructure changes. Keep in mind that -target is useful for focused work or debugging, but you should eventually run a full plan and apply to bring the entire state into a consistent, correct configuration.

When you want to update only a specific part of your infrastructure, limit Terraform’s action to that resource using the -target option with the apply command. This focuses the plan and the changes on the chosen resource and any resources that depend on it, allowing you to apply just those updates without touching the rest of your configuration. Running a plan without a target would generate changes for all managed resources, not a subset. Removing other resources from the config is not a safe or practical way to isolate changes, and formatting the code doesn’t apply any infrastructure changes. Keep in mind that -target is useful for focused work or debugging, but you should eventually run a full plan and apply to bring the entire state into a consistent, correct configuration.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy