Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 138 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 138
Topic #: 1
[All Terraform Associate Questions]

You have modified your Terraform configuration to fix a typo in the Terraform ID of a resource from aws_security_group.http to aws_security_group.http

Which of the following commands would you run to update the ID in state without destroying the resource?

  • A. terraform mv aws_security_group.htp aws_security_group.http
  • B. terraform apply
  • C. terraform refresh
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Burakko
Highly Voted 2 years, 2 months ago
Selected Answer: A
I guess it had to be terraform state mv ..... The terraform state mv command changes which resource address in your configuration is associated with a particular real-world object. Use this to preserve an object when renaming a resource, or when moving a resource into or out of a child module.
upvoted 13 times
...
adouban
Highly Voted 1 year, 11 months ago
Selected Answer: A
A is correct but the command is wrong it should be terraform state mv <old_name> <new_name>
upvoted 10 times
...
ravi135
Most Recent 9 months, 2 weeks ago
A is correct
upvoted 1 times
...
samimshaikh
11 months ago
Selected Answer: A
options are wrong and it terraform state mv oldid newid
upvoted 1 times
...
bizimunda
1 year ago
there is no such command as of 2023. The correct command is terraform state mv
upvoted 3 times
...
camps
1 year, 7 months ago
Selected Answer: A
A. terraform mv aws_security_group.htp aws_security_group.http. The terraform mv command is used to rename a resource in your Terraform state without destroying it. In this case, you have fixed a typo in the Terraform ID of a resource, so you can use the terraform mv command to update the ID in the state without destroying the resource.
upvoted 2 times
...
RVivek
2 years, 1 month ago
Selected Answer: A
Terraform apply will delete the security group htp and create a new scurity group with the name http
upvoted 1 times
...
shopkitty
2 years, 2 months ago
Selected Answer: A
if use the apply then it will destroy and re-create the resource, only terraform state mv allows to update the state file without destroying resources.
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
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.

SaveCancel
Loading ...