Terraform v0.7.1
aws_volume_attachment
https://gist.github.com/nicocesar/378565e259cc5e5ae6076b571344f377
https://gist.github.com/nicocesar/5e2e8f9c9290179b1fb0a61509cf30e8
I've imported the volume and the instace using terraform import. But I don't know how to import the aws_volume_attachment. When I execute the terraform apply it tries to attach an _already attached_ volume.
I just want to: a) do not report a missing attachment or b) know how to use terraform import to add this information too.
Hi,
Our 2 issues seems close: https://github.com/hashicorp/terraform/issues/9910
Have you found a solution to this problem ? To me, we need to import the aws_volume_attachment but I don't know how to find it through aws.
If it can help someone, I manually updated the aws_volume_attachment in the terraform state to match the new requirements. It seems that this aws_volume_attachment_id doesn't exist in amazon but only for terraform
Can you provide a diff of your "manual update"?
On Mon, Nov 7, 2016, 07:55 thibault deheurles [email protected]
wrote:
If it can help someone, I manually updated the aws_volume_attachment in
the terraform state to match the new requirements. It seems that this
aws_volume_attachment_id doesn't exist in amazon but only for terraform—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/hashicorp/terraform/issues/8458#issuecomment-258828296,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAZ8eS55F7ulVGoKD6o5RzF367qKT0tpks5q7x-0gaJpZM4JsXzN
.
Here is the part of the json for the aws_volume_attachment :
"aws_volume_attachment.name": {
"type": "aws_volume_attachment",
"depends_on": [
"aws_ebs_volume.name",
"aws_instance.name"
],
"primary": {
"id": "vai-1501514762",
"attributes": {
"device_name": "xvdh",
"id": "vai-1501514762",
"instance_id": "i-0df597a608df3c6fb",
"volume_id": "vol-d4398402"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": ""
}
So I have just updated :
aws_volume_attachment.name.primary.attributes.instance_idaws_volume_attachment.name.primary.attributes.volume_idNote that these 2 resources were imported with terraform import before.
I have the same problem. Where does this id come from?
This ID is generated when Terraform writes the attachment to the state file. I had the same issue when I imported some resources and had to modify the state file by hand. Since you can't use "terraform import" on a volume attachment your options are limited. You can either force detach and let Terraform attach the volume, or you can manually update the state file and regenerate the "vai" ID. To make this easier I pulled the relevant code that generates that ID and put it on github. https://github.com/foxsy/tfvolattid
Thanks for the relevant information, @foxsy but why can't terraform just do that for you upon import? is there anything I'm missing here? by the time you do terraform import aws_ebs_volume.shell_data vol-fbaa2524 (look in my example) can't it ask you for a mount point or some extra info to make this happen without manual interventions... I have pending to migrate to terraform many clusters, I don't want to do manually all this conversions
Closed via #11060
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
This ID is generated when Terraform writes the attachment to the state file. I had the same issue when I imported some resources and had to modify the state file by hand. Since you can't use "terraform import" on a volume attachment your options are limited. You can either force detach and let Terraform attach the volume, or you can manually update the state file and regenerate the "vai" ID. To make this easier I pulled the relevant code that generates that ID and put it on github. https://github.com/foxsy/tfvolattid