0

I am importing aws_backup_selection resource but I receive an error:

Error: unexpected format of ID ("56XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"), expected <plan-id>|<selection-id>

I am importing the resource with the following command:

terraform import aws_backup_selection.my_backup_selection 56XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX|1eXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

According to the official documentation this is how you import this kind of records:

$ terraform import aws_backup_selection.example plan-id|selection-id

The plan-id and selection-id provided values are correct.

I am not sure what I am doing wrong, I am following the guide. I even tried something like this which I know makes no sense.

terraform import aws_backup_selection.my_backup_selection 56XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | 1eXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
terraform import aws_backup_selection.my_backup_selection <56XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX>|<1eXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX>
terraform import aws_backup_selection.my_backup_selection "56XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"|"1eXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

1 Answers1

1

terraform import "name_of_object" name_of_resource like this

terraform import "aws_backup_selection.example" "1fa13336-32af-4234-a562-71f5fe4c852b|e654d6d9-cef1-3bad-bec5-cb222adc22a9" 

to get "name_of_object" you can run terraform plan and find it. Do no forget "" everywhere and check roles. Make sure that role that you use has correct assume settings. see screenshot

Siarhej
  • 71
  • 3
  • Sorry, but this answer is not related to the question. Please make sure you read the question carefully and then post your answer. – Marko E Nov 22 '22 at 11:03
  • sorry, but I found time and tested it. And added updated example + screenshot. – Siarhej Nov 22 '22 at 15:42
  • Great! Make sure you remove the real resource IDs from the command as well. Also, I would suggest you add the output of the command as text and not a screenshot. :) – Marko E Nov 22 '22 at 16:04
  • Sure, "never send id or aws access keys". a golden rule – Siarhej Nov 22 '22 at 16:42