Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.
A is the correct answer.
Terraform says
Warning: This command is deprecated, because its default behavior is unsafe if you have misconfigured credentials for any of your providers.
You shouldn't typically need to use this command, because Terraform automatically performs the same refreshing actions as a part of creating a plan in both the terraform plan and terraform apply commands.
"The Terraform refresh command reads the current settings from all managed remote objects and updates the Terraform state to match."
Warning: This command is deprecated because its default behaviour is unsafe if you have misconfigured credentials for any of your providers. See below for more information and recommended alternatives.
This won't modify your real remote objects, but it will modify the Terraform state.
"You shouldn't typically need to use this command, because Terraform automatically performs the same refreshing actions as a part of creating a plan in both the Terraform plan and Terraform apply commands. This command is here primarily for backward compatibility, but we don't recommend using it because it provides no opportunity to review the effects of the operation before updating the state."
Link:https://developer.hashicorp.com/terraform/cli/commands/refresh
```The terraform refresh command reads the current settings from all managed remote objects and updates the Terraform state to match.
Warning: This command is deprecated, because its default behavior is unsafe if you have misconfigured credentials for any of your providers. See below for more information and recommended alternatives.```
there are two ways to do this manually remove the resource using "terraform rm" from the state management and the other way is to refresh the state. Since the option given in this question is not clear enough as to run "terraform rm" or not in option C, I will go with option A is the best suited.
terraform refresh
in the context of question resource is deleted manually mean we can just refresh the state while terrafrom rm command or manually updating state file updated than resources will be still there so I will go with a TERRAFORM REFRESH
The should be B
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.
If you don't want to automatically refresh, you can use the 'terraform apply -refresh-only' without the -auto-approve option
terraform refresh is deprecated
https://developer.hashicorp.com/terraform/cli/commands/refresh
unless, you are using old version of TF that doesn't support the refresh-only
but you shouldn't typically need to use this command, because Terraform automatically performs the same refreshing actions as a part of creating a plan in both the 'terraform plan' and ' terraform apply' commands.
Read the document carefully :-)
The document mentions the reason for the deprecation and recommends alternatives.
"A" is not the best practice in the real world, but is the best answer available here.
"B" it won't automatically happen unless run some command.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
tf181
Highly Voted 2 years, 2 months agoG__
Highly Voted 2 years, 2 months agocallmegio
Most Recent 2 weeks, 6 days agostarkonbullet
1 month, 3 weeks agodeepakpamban
2 months agoDarrylNg
2 months, 2 weeks agoravk2321
4 months agoakkam89
4 months, 1 week agodizzy_monkey
4 months, 2 weeks agoDeva2596
5 months, 3 weeks agosamimshaikh
6 months, 1 week agosamimshaikh
6 months, 1 week agoTigerInTheCloud
6 months, 3 weeks agoRtech75
7 months, 2 weeks agoIIIIIIIIIlllll
8 months agoTyler2023
8 months, 2 weeks agoTyler2023
8 months, 2 weeks agoTigerInTheCloud
6 months, 3 weeks agoBadii
9 months, 1 week agogofavad926
9 months, 1 week ago