Skip to content

Commit

Permalink
providers/aws: subnet retry destroy [GH-357]
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Oct 8, 2014
1 parent ef62fa8 commit ca99811
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ BUG FIXES:
* core: Plugin loading from CWD works properly.
* providers/aws: autoscaling_group can be launched into a vpc [GH-259]
* providers/aws: not an error when RDS instance is deleted manually. [GH-307]
* providers/aws: Retry deleting subnet for some time while AWS eventually
destroys dependencies. [GH-357]

## 0.2.2 (September 9, 2014)

Expand Down
6 changes: 5 additions & 1 deletion builtin/providers/aws/resource_aws_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ func resource_aws_subnet_destroy(
ec2conn := p.ec2conn

log.Printf("[INFO] Deleting Subnet: %s", s.ID)
if _, err := ec2conn.DeleteSubnet(s.ID); err != nil {
f := func() error {
_, err := ec2conn.DeleteSubnet(s.ID)
return err
}
if err := resource.Retry(10 * time.Second, f); err != nil {
ec2err, ok := err.(*ec2.Error)
if ok && ec2err.Code == "InvalidSubnetID.NotFound" {
return nil
Expand Down
3 changes: 0 additions & 3 deletions builtin/providers/aws/resource_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,4 @@ func testAccPreCheck(t *testing.T) {
log.Println("[INFO] Test: Using us-west-2 as test region")
os.Setenv("AWS_REGION", "us-west-2")
}
if v := os.Getenv("AWS_SSL_CERTIFICATE_ID"); v == "" {
t.Fatal("AWS_SSL_CERTIFICATE_ID must be set for acceptance tests")
}
}

0 comments on commit ca99811

Please sign in to comment.