TA-002-P · Question #423
Which of the following is true about terraform apply? (Choose two.)
The correct answer is A. It only operates on infrastructure defined in the current working directory or workspace C. Depending on provider specification, Terraform may need to destroy and recreate your. terraform apply operates on infrastructure defined in the current working directory's configuration and workspace, and can sometimes destroy and recreate resources based on provider logic.
Question
Which of the following is true about terraform apply? (Choose two.)
Options
- AIt only operates on infrastructure defined in the current working directory or workspace
- BYou must pass the output of a terraform plan command to it
- CDepending on provider specification, Terraform may need to destroy and recreate your
- DBy default, it does not refresh your state file to reflect current infrastructure configuration
- EYou cannot target specific resources for the operation
How the community answered
(27 responses)- A96% (26)
- E4% (1)
Why each option
terraform apply operates on infrastructure defined in the current working directory's configuration and workspace, and can sometimes destroy and recreate resources based on provider logic.
terraform apply executes the actions defined by the configuration files in the current working directory or selected workspace, making it specific to that context.
While you can pass a plan file to terraform apply, it is not a requirement; terraform apply can generate a plan itself if no plan file is provided.
If a resource's attribute is changed to one that cannot be updated in-place by the provider, Terraform may need to destroy the existing resource and recreate it with the new configuration.
By default, terraform apply performs an implicit refresh to update the state file with the latest real-world infrastructure configuration before proposing changes.
terraform apply supports targeting specific resources using the -target option, allowing selective application of changes.
Concept tested: Terraform apply command behavior
Source: https://developer.hashicorp.com/terraform/cli/commands/apply
Topics
Community Discussion
No community discussion yet for this question.