Skip to content

fix: allow stopping instance before detachment and/or forced ebs detachments #212

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

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

Hamza-Olol
Copy link
Contributor

Added support to the EBS volume attachment resource for the force_detach and stop_instance_before_detaching arguments.

These changes allow users to:
- Force the detachment of EBS volumes.
- Stop instances before detaching volumes, ensuring smooth resource teardown during Terraform destroy operations.

why

I cannot delete my Terraform resources using a standard Terraform destroy because I have attached additional ebs volumes to my instance and then ran disk configuration changes in my instance, for example, combined multiple ebs volumes into a striped disk config.

Business use cases may require additional EBS volumes, along with specific disk configurations for the volumes attached to EC2 instances.

When attempting to delete resources via Terraform, the destroy process fails due to issues with EBS volume attachments. These issues include timeouts or the inability to delete volumes because they are in a "busy" state.

The problem arises because Terraform attempts to detach EBS volumes before deleting/stopping the EC2 instance, leading to failures if the volume cannot be detached.

To address this, Terraform introduced the force_detach and stop_instance_before_detaching arguments, which allows forced detachment and/or stopping of the instance prior to detaching volumes. These enhancements mitigate the destroy-time failures and ensure smoother resource cleanup.

references

The force_detach and stop_instance_before_detaching arguments were introduced in Terraform AWS provider version v3.62.0.

Additional details and discussion about this issue can be found in this GitHub thread.

@Hamza-Olol Hamza-Olol requested review from a team as code owners November 19, 2024 00:08
@mergify mergify bot added the triage Needs triage label Nov 19, 2024
@Hamza-Olol Hamza-Olol changed the title fix: allow forced ebs detachments and stopping instance before detachment fix: allow stopping instance before detachment and/or forced ebs detachments Nov 19, 2024
@GabisCampana
Copy link

@johncblandii @aknysh @goruha

@goruha
Copy link
Member

goruha commented Nov 27, 2024

/terratest

@goruha goruha merged commit 7409758 into cloudposse:main Nov 27, 2024
29 checks passed
@mergify mergify bot removed the triage Needs triage label Nov 27, 2024
Copy link
Contributor

These changes were released in v1.6.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants