TERRAFORM-ASSOCIATE-004 · Question #89
A developer on your team is going lo leaf down an existing deployment managed by Terraform and deploy a new one. However, there is a server resource named aws instant.ubuntu[l] they would like to keep
The correct answer is B. Terraform state rm:aws_instance.ubuntu[1]. To tell Terraform to stop managing a specific resource without destroying it, you can use the terraform state rm command. This command will remove the resource from the Terraform state, which means that Terraform will no longer track or update the corresponding remote object. How
Question
Options
- ATerraform plan rm:aws_instance.ubuntu[1]
- BTerraform state rm:aws_instance.ubuntu[1]
- CTerraform apply rm:aws_instance.ubuntu[1]
- DTerraform destory rm:aws_instance.ubuntu[1]
How the community answered
(51 responses)- A2% (1)
- B86% (44)
- C8% (4)
- D4% (2)
Explanation
To tell Terraform to stop managing a specific resource without destroying it, you can use the terraform state rm command. This command will remove the resource from the Terraform state, which means that Terraform will no longer track or update the corresponding remote object. However, the object will still exist in the remote system and you can later use terraform import to start managing it again in a different configuration or workspace. The syntax for this command is terraform state rm <address>, where <address> is the resource address that identifies the resource instance to remove. For example, terraform state rm aws_instance.ubuntu[1] will remove the second instance of the aws_instance resource named ubuntu from the state.
Topics
Community Discussion
No community discussion yet for this question.