Skip to content

Commit b43ca0a

Browse files
committed
providers/aws: handle case where ELB is deleted manually [hashicorpGH-304]
1 parent c5c72b1 commit b43ca0a

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ BUG FIXES:
6363
data.
6464
* providers/aws: ELB works properly with dynamically changing
6565
count of instances.
66+
* providers/aws: Terraform can handle ELBs deleted manually. [GH-304]
6667

6768
## 0.2.2 (September 9, 2014)
6869

builtin/providers/aws/resource_aws_elb.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,12 @@ func resourceAwsElbRead(d *schema.ResourceData, meta interface{}) error {
319319

320320
describeResp, err := elbconn.DescribeLoadBalancers(describeElbOpts)
321321
if err != nil {
322+
if ec2err, ok := err.(*elb.Error); ok && ec2err.Code == "LoadBalancerNotFound" {
323+
// The ELB is gone now, so just remove it from the state
324+
d.SetId("")
325+
return nil
326+
}
327+
322328
return fmt.Errorf("Error retrieving ELB: %s", err)
323329
}
324330
if len(describeResp.LoadBalancers) != 1 {

0 commit comments

Comments
 (0)