TERRAFORM-ASSOCIATE-004 · Question #264
What happens when you apply Terraform configuration? (Choose TWO correct answers)
The correct answer is A. Terraform makes any infrastructure changes defined in your configuration. C. Terraform updates the state file with any configuration changes it made.. Applying a Terraform configuration results in infrastructure changes being made in the cloud provider and the state file being updated to reflect these changes.
Question
Options
- ATerraform makes any infrastructure changes defined in your configuration.
- BTerraform gets the plugins that the configuration requires.
- CTerraform updates the state file with any configuration changes it made.
- DTerraform corrects formatting errors in your configuration.
- ETerraform destroys and recreates all your infrastructure from scratch.
How the community answered
(60 responses)- A88% (53)
- B3% (2)
- D2% (1)
- E7% (4)
Why each option
Applying a Terraform configuration results in infrastructure changes being made in the cloud provider and the state file being updated to reflect these changes.
When `terraform apply` is executed, Terraform proceeds to create, update, or destroy infrastructure resources in the target cloud provider to match the desired state defined in the configuration files.
The process of downloading and configuring provider plugins is handled by `terraform init`, which must be run before `terraform apply`.
Upon successful completion of infrastructure changes, `terraform apply` updates the Terraform state file to accurately reflect the current configuration and status of the managed resources in the real world.
Terraform does not automatically correct formatting errors during an `apply` operation; instead, it will report syntax errors and halt, with `terraform fmt` being the command for formatting.
Terraform apply performs incremental changes to bring the infrastructure to the desired state, only destroying and recreating resources when absolutely necessary due to configuration changes, rather than always starting from scratch.
Concept tested: Terraform apply command actions
Source: https://developer.hashicorp.com/terraform/cli/commands/apply
Topics
Community Discussion
No community discussion yet for this question.