When do you need to explicitly execute terraform refresh?
When do you need to explicitly execute terraform refresh?
Terraform refresh explicitly updates the state file with the real infrastructure. Normally, Terraform performs this refresh automatically during the plan and apply commands. Therefore, it is generally unnecessary to execute terraform refresh manually, making 'None of the above' the correct choice.
The answer is correct. Wherever possible, avoid using terraform refresh explicitly and instead rely on Terraform's behavior of automatically refreshing existing objects as part of creating a normal plan. Source: https://www.terraform.io/cli/commands/refresh
so the answer is D
D. None of the above. Refresh is used to check backward compatibility to read the infrastructure objects, and update the state file. Terraform performs refresh by itself during every plan and apply commands. So, it is recommended that we not perform refresh often.
As per Terraform documentation refresh command is not recommended, it is there only for backward compatibility
D is correct
D is correct
https://www.terraform.io/cli/commands/refresh