-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 Error waiting for Volume #4770
Comments
I can confirm this for our infra too. On latest Terraform, destroying aws_volume_attachment and aws_instance together fails with this timeout error. |
Running into this as well. |
|
this is also a problem if ebs volume ids are replaced in the template, you'll get a similar error. if a volume can't be detached, it would be good to have a variable that did both these things- this would also help when doing terraform destroy. I've attached an example below from changing the aws_volume_attachement name that causes the same problem. Error: Error applying plan: 5 error(s) occurred:
|
I ran into this today, is there a workaround? I tried running |
FYI, I ran into this when implementing Windows servers with MSSQL. I found that adding a null_resource which has a depends_on for the instance and a remote-exec provisioner which includes a 'when = "destroy"' option and executes a Powershell command stop the MSSQLSERVER service on the host. After this, terraform destroy will destroy the attachment. You could replace the MSSQL service with relevant shell commands to stop services, unmount disks, etc. |
Even I'm facing this issue. Terraform v0.12.1
|
Terraform v0.12.3
Still failing... |
I have the same issue Terraform v0.12.5
|
We are facing this issue as well. Terraform v0.12.5 |
Facing same issue Terraform v0.11.14
|
We have the same problem Terraform 0.12.7 and provider AWS 2.25.0 |
Facing the same issue here, we worked around it by including According to the documentation, setting |
Hey all, Happy Holidays.
If the volume is still mounted on the instance, it will never detach (it even shows gray in the AWS console, so terraform may be able to help us here). Debugging terraform with After I unmounted the volume, terraform destroyed the volume attachment successfully. |
If we're listing workarounds, shutting down the instance before the destroy will work as well. The detach will work since the volume would not be "busy" at that point. |
Same problem here. Only been a bug 19 months. Could we get Terraform to STOP instances with attached storage, DETACH/DELETE all volumes and then TERMINATE the instance? Seems like a fundamental function fails often in this circumstance. |
Probably there should be a provision to run a script just before volume is detached. |
+1 here |
another day, another issue with super basic stuff expected from TF. No response from TF also. For the record:
Issue persists. |
Got this issue too.
|
Encountered Same issue, have to manually unmount to volume and then proceed with terraform destroy. |
persists in
|
Problem still here |
Same problem!!!
|
Same issue. We're using Terraform v0.13.4. |
still hitting this with terraform 1.0.2 and AWS provider 3.5. stopping the instance first allowed me to destroy. Terraform v1.0.2
|
Couldn't detatch volume, not even with EC2 Management Console. The volume attachment was in state detaching. I manually stopped the instance, then the attachment was successfully detached by itself. Was using Terraform v0.12.31 |
Same here, using:
If the volume is mounted the destruction fails, however if I unmount the volume then the attachment destruction, and later the instance destruction, both succeed. While this is logical, I would expect terraform to first destroy the instance (unmounting the volume in the process) and then destroy the volume attachment. |
This logic was used to ensure that the EC2 instance for an AWS EBS volume attachment was in a terminated state so that the volume attachment could be destroyed successfully. This has not been an issue in more recent COOL configurations so we are removing it here. In the event that this is still an problem a relevant issue can be found at: hashicorp/terraform-provider-aws#4770
I'm also having this issue in terraform 1.0.7 |
Thank you for reporting this and your continued interest. This issue should be resolved with the feature added in #21144. If that does not resolve the issue, please open a new issue and reference this one. |
This functionality has been released in v3.62.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
Terraform Version
Terraform v0.11.7
Affected Resource(s)
aws_volume_attachment
Actual Behavior
When running a
terraform destroy
, in which you want to destroy anaws_instance
and it'saws_volume_attachment
, terraform (or the AWS API) will attempt to destroy the volume attachment first, then then instance second. This often fails becauseError waiting for Volume (vol-010b3d979b1027867) to detach from Instance
.Expected Behavior
If an
aws_volume_attachment
was going to be destroyed, and the associatedaws_instance
was also going to be destroyed, it would make sense to destroy the instance first and then theaws_volume_attachment
second, which would never run any risk of timing out.Steps to Reproduce
aws_ebs_volume
, anaws_instance
, and aaws_volume_attachment
.terraform destroy
The text was updated successfully, but these errors were encountered: