terraform import aws_backup_selection error unexpected ID format

621 Views Asked by At

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

There are 1 best solutions below

4
On

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