HashiCorp Certified: Terraform Associate — Question 78

A fellow developer on your team is asking for some help in refactoring their Terraform code. As part of their application's architecture, they are going to tear down an existing deployment managed by Terraform and deploy new. However, there is a server resource named aws_instance.ubuntu[1] they would like to keep to perform some additional analysis.
What command should be used to tell Terraform to no longer manage the resource?

Answer options

Correct answer: B

Explanation

The correct command is 'terraform state rm aws_instance.ubuntu[1]', which removes the specified resource from Terraform's state management without deleting the actual resource. The other options are incorrect because 'terraform apply' and 'terraform plan' do not remove resources, and 'terraform delete' is not a valid Terraform command.