I am trying to import a manually created EBS volume attached to an ec2 consisting 4 ebs volumes in total.
The 3 volumes where created and attached to an EC2 from terraform code and are part of TF state file.
The new 4th volume was created manually from aws console. There are two ec2’s these volumes are part of index reference as [0] and [1] in TF state file.
~ terraform state file snippet for reference
The issue is terraform import command result in following error message :
~
│ Error: Invalid address
│
│ on line 1:
│ 1: module.db_instances.module.aws_instance.ebs_block_device.this[3].id
│
│ Unexpected extra operators after address.
~
Tried below commands:
~
terraform import module.db_instances.module.aws_instance.ebs_block_device.this[3].volume_id vol-00XXXXXX
terraform import module.db_instances.module.aws_instance.ebs_block_device.this[3].id vol-00XXXXXXX
terraform import module.db_instances.module.aws_instance.this[0].ebs_block_device.this[3] vol-00XXXXXX
terraform import module.db_instances.module.aws_instance.ebs_block_device[3].volume_id vol-00XXXXXXX
terraform import module.db_instances.module.aws_instance[0].ebs_block_device.this[3].volume_id vol-00XXXXXX
terraform import module.db_instances.module.aws_instance.aws_instance.this[0].ebs_block_device.this[3].volume_id vol-00XXXXXXXX
~
I have also added the additional ebs volume configuration block in the TF code
for manually created ebs block mapping
Can you please suggest issue in TF command import ?
Vishnupriya Varada is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.