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

r/aws_alb: Cleanup ENIs after deleting ALB #1427

Merged
merged 1 commit into from
Aug 17, 2017
Merged

Conversation

radeksimko
Copy link
Member

Similar to #1036 - just for ALBs.

Closes #40

Test results

=== RUN   TestAccAWSALB_generatesNameForZeroValue
--- FAIL: TestAccAWSALB_generatesNameForZeroValue (370.87s)
	testing.go:435: Step 0 error: Error applying: 1 error(s) occurred:
		
		* aws_internet_gateway.gw: 1 error(s) occurred:
		
		* aws_internet_gateway.gw: Error waiting for internet gateway (igw-2444de43) to attach: timeout while waiting for state to become 'available' (timeout: 4m0s)
=== RUN   TestAccAWSALB_noSecurityGroup
--- PASS: TestAccAWSALB_noSecurityGroup (404.35s)
=== RUN   TestAccAWSALB_updatedSecurityGroups
--- PASS: TestAccAWSALB_updatedSecurityGroups (409.52s)
=== RUN   TestAccAWSALB_updatedIpAddressType
--- PASS: TestAccAWSALB_updatedIpAddressType (449.90s)
=== RUN   TestAccAWSALB_updatedSubnets
--- PASS: TestAccAWSALB_updatedSubnets (561.85s)
=== RUN   TestAccAWSALB_accesslogs
--- PASS: TestAccAWSALB_accesslogs (600.44s)
=== RUN   TestAccAWSALB_generatedName
--- PASS: TestAccAWSALB_generatedName (622.92s)
=== RUN   TestAccAWSALB_tags
--- PASS: TestAccAWSALB_tags (703.79s)
=== RUN   TestAccAWSALB_namePrefix
--- PASS: TestAccAWSALB_namePrefix (821.56s)
=== RUN   TestAccAWSALB_basic
--- PASS: TestAccAWSALB_basic (892.93s)

Debug log snippet

$ grep -h 'ENIs to cleanup for ALB' ./debug-aws-28606e1.log
2017/08/16 07:42:22 [DEBUG] Found 1 ENIs to cleanup for ALB "app/tf-lb-20170816073921274100000001/6a9f323951898014"
2017/08/16 07:43:18 [DEBUG] Found 1 ENIs to cleanup for ALB "app/testaccawsalb-nosg-hp2qc6z17j/818406808994a98d"
2017/08/16 07:43:18 [DEBUG] Found 1 ENIs to cleanup for ALB "app/testaccawsalb-basic-k492r98v1c/34a06520d7aaa53b"
2017/08/16 07:43:42 [DEBUG] Found 1 ENIs to cleanup for ALB "app/testaccawsalb-basic-fq7wg2u2te/27c06f719526bfb3"
2017/08/16 07:45:03 [DEBUG] Found 1 ENIs to cleanup for ALB "app/tf-lb-20170816073833572000000001/8d1f8af0fca15c9c"
2017/08/16 07:45:21 [DEBUG] Found 1 ENIs to cleanup for ALB "app/testaccawsalb-basic-rds8vieupa/648e743cf9994057"
2017/08/16 07:46:25 [DEBUG] Found 1 ENIs to cleanup for ALB "app/testaccawsalbaccesslog-zeig/640f4f8ceaf31c63"
2017/08/16 07:47:56 [DEBUG] Found 1 ENIs to cleanup for ALB "app/testaccawsalb-basic-enrf9z3i7h/79b4a339bc39c0f6"
2017/08/16 07:50:05 [DEBUG] Found 1 ENIs to cleanup for ALB "app/tf-lb-20170816074724825300000001/20bcce6886165959"
2017/08/16 07:51:47 [DEBUG] Found 0 ENIs to cleanup for ALB "app/testaccawsalb-basic-0rd642ipo2/a68685c31921dfa6"

@radeksimko radeksimko added the bug Addresses a defect in current functionality. label Aug 16, 2017
Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

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

Looks good to me! :)

Just left 2 small comments :)

@@ -401,6 +402,62 @@ func resourceAwsAlbDelete(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Error deleting ALB: %s", err)
}

err := cleanupALBNetworkInterfaces(meta.(*AWSClient).ec2conn, d.Id())
if err != nil {
log.Printf("[WARN] Failed to cleanup ENIs for ELB %q: %#v", d.Id(), err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be ALB instead of ELB?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll change it. Thanks for spotting it!

},
{
Name: aws.String("description"),
Values: []*string{aws.String("ELB " + name)},
Copy link
Contributor

Choose a reason for hiding this comment

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

is ALB failing here? more a question rather than a remark :)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is actually intention - the underlying API uses a different naming convention, "ELB v2" they call it, so ELB is correct here in this context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good to know, thanks! :)

@radeksimko radeksimko merged commit 0529458 into master Aug 17, 2017
@radeksimko radeksimko deleted the f-alb-eni-cleanup branch August 17, 2017 20:31
nbaztec pushed a commit to nbaztec/terraform-provider-aws that referenced this pull request Sep 26, 2017
…cleanup

r/aws_alb: Cleanup ENIs after deleting ALB
@ghost
Copy link

ghost commented Apr 11, 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 Apr 11, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_elb with a security group does not always successfully destroy
2 participants