-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_volume_attachment complains about "VolumeInUse" from imported resources #8458
Comments
Hi, Have you found a solution to this problem ? To me, we need to import the |
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 notifications@github.com
|
Here is the part of the json for the "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 :
Note that these 2 resources were imported with |
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. |
Terraform Version
Terraform v0.7.1
Affected Resource(s)
aws_volume_attachment
TF files
https://gist.github.com/nicocesar/378565e259cc5e5ae6076b571344f377
Debug Output
https://gist.github.com/nicocesar/5e2e8f9c9290179b1fb0a61509cf30e8
Expected Behavior
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.
Steps to Reproduce
The text was updated successfully, but these errors were encountered: