Skip to content
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

resource/aws_launch_configuration: Prevent ResourceInUse errors caused by eventual consistency during deletion #7819

Merged
merged 1 commit into from
Mar 7, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Mar 6, 2019

Closes #502
Closes #646

Also discovered during acceptance testing, which was no longer present after this change:

--- FAIL: TestAccAWSAutoScalingGroup_basic (233.37s)
    testing.go:599: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: Error applying: 1 error occurred:
          * aws_launch_configuration.foobar (destroy): 1 error occurred:
          * aws_launch_configuration.foobar: ResourceInUse: Cannot delete launch configuration terraform-20190305190002502900000001 because it is attached to AutoScalingGroup terraform-test-xkagj2tcwm

It appears the Autoscaling service can display an eventual consistency delay between when an Autoscaling Group requiring a Launch Configuration is deleted and deleting the Launch Configuration immediately after.

Output from acceptance testing:

--- PASS: TestAccAWSLaunchConfiguration_importBasic (14.18s)
--- PASS: TestAccAWSLaunchConfiguration_withSpotPrice (15.10s)
--- PASS: TestAccAWSLaunchConfiguration_ebs_noDevice (16.20s)
--- PASS: TestAccAWSLaunchConfiguration_withBlockDevices (17.60s)
--- PASS: TestAccAWSLaunchConfiguration_withEncryption (19.82s)
--- PASS: TestAccAWSLaunchConfiguration_userData (26.26s)
--- PASS: TestAccAWSLaunchConfiguration_basic (28.43s)
--- PASS: TestAccAWSLaunchConfiguration_updateEbsBlockDevices (30.24s)
--- PASS: TestAccAWSLaunchConfiguration_updateRootBlockDevice (31.82s)
--- PASS: TestAccAWSLaunchConfiguration_withIAMProfile (35.39s)
--- PASS: TestAccAWSLaunchConfiguration_withVpcClassicLink (37.53s)

…d by eventual consistency during deletion

References:
* #502
* #646

Also discovered during acceptance testing, which was no longer present after this change:

```
--- FAIL: TestAccAWSAutoScalingGroup_basic (233.37s)
    testing.go:599: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: Error applying: 1 error occurred:
          * aws_launch_configuration.foobar (destroy): 1 error occurred:
          * aws_launch_configuration.foobar: ResourceInUse: Cannot delete launch configuration terraform-20190305190002502900000001 because it is attached to AutoScalingGroup terraform-test-xkagj2tcwm
```

It appears the Autoscaling service can display an eventual consistency delay between when an Autoscaling Group requiring a Launch Configuration is deleted and deleting the Launch Configuration immediately after.

Output from acceptance testing:

```
--- PASS: TestAccAWSLaunchConfiguration_importBasic (14.18s)
--- PASS: TestAccAWSLaunchConfiguration_withSpotPrice (15.10s)
--- PASS: TestAccAWSLaunchConfiguration_ebs_noDevice (16.20s)
--- PASS: TestAccAWSLaunchConfiguration_withBlockDevices (17.60s)
--- PASS: TestAccAWSLaunchConfiguration_withEncryption (19.82s)
--- PASS: TestAccAWSLaunchConfiguration_userData (26.26s)
--- PASS: TestAccAWSLaunchConfiguration_basic (28.43s)
--- PASS: TestAccAWSLaunchConfiguration_updateEbsBlockDevices (30.24s)
--- PASS: TestAccAWSLaunchConfiguration_updateRootBlockDevice (31.82s)
--- PASS: TestAccAWSLaunchConfiguration_withIAMProfile (35.39s)
--- PASS: TestAccAWSLaunchConfiguration_withVpcClassicLink (37.53s)
```
@bflad bflad added bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service. labels Mar 6, 2019
@bflad bflad requested a review from a team March 6, 2019 01:15
@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Mar 6, 2019
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bflad bflad added this to the v2.1.0 milestone Mar 7, 2019
@bflad bflad merged commit d5fbe69 into master Mar 7, 2019
@bflad bflad deleted the b-aws_launch_configuration-retry-deletion branch March 7, 2019 20:20
bflad added a commit that referenced this pull request Mar 7, 2019
@bflad
Copy link
Contributor Author

bflad commented Mar 8, 2019

This has been released in version 2.1.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Mar 31, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service. size/S Managed by automation to categorize the size of a PR.
Projects
None yet
2 participants