Skip to content

Commit

Permalink
providers/aws: handle case where ELB is deleted manually [GH-304]
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Oct 10, 2014
1 parent c5c72b1 commit b43ca0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ BUG FIXES:
data.
* providers/aws: ELB works properly with dynamically changing
count of instances.
* providers/aws: Terraform can handle ELBs deleted manually. [GH-304]

## 0.2.2 (September 9, 2014)

Expand Down
6 changes: 6 additions & 0 deletions builtin/providers/aws/resource_aws_elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ func resourceAwsElbRead(d *schema.ResourceData, meta interface{}) error {

describeResp, err := elbconn.DescribeLoadBalancers(describeElbOpts)
if err != nil {
if ec2err, ok := err.(*elb.Error); ok && ec2err.Code == "LoadBalancerNotFound" {
// The ELB is gone now, so just remove it from the state
d.SetId("")
return nil
}

return fmt.Errorf("Error retrieving ELB: %s", err)
}
if len(describeResp.LoadBalancers) != 1 {
Expand Down

0 comments on commit b43ca0a

Please sign in to comment.