Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 135


When do you need to explicitly execute terraform refresh?

Show Answer
Correct Answer: D

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.

Discussion

6 comments
Sign in to comment
Uma10
Mar 1, 2023

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

keiffo2
Mar 6, 2023

so the answer is D

Pinky0289
Mar 13, 2023

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.

RVivekOption: D
Mar 26, 2023

As per Terraform documentation refresh command is not recommended, it is there only for backward compatibility

depal_dhirOption: D
Mar 7, 2023

https://www.terraform.io/cli/commands/refresh

hajurbauOption: D
Mar 6, 2024

D is correct

Darshan07Option: D
Aug 27, 2024

D is correct