Skip to content

Commit

Permalink
resource/aws_lb_listener: Remove extraneous isListenerNotFound function
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad committed Mar 26, 2018
1 parent 941ce36 commit 6c67b85
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions aws/resource_aws_lb_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/elbv2"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/terraform/helper/resource"
Expand Down Expand Up @@ -156,7 +155,7 @@ func resourceAwsLbListenerRead(d *schema.ResourceData, meta interface{}) error {
ListenerArns: []*string{aws.String(d.Id())},
})
if err != nil {
if isListenerNotFound(err) {
if isAWSErr(err, elbv2.ErrCodeListenerNotFoundException, "") {
log.Printf("[WARN] DescribeListeners - removing %s from state", d.Id())
d.SetId("")
return nil
Expand Down Expand Up @@ -258,11 +257,6 @@ func resourceAwsLbListenerDelete(d *schema.ResourceData, meta interface{}) error
return nil
}

func isListenerNotFound(err error) bool {
elberr, ok := err.(awserr.Error)
return ok && elberr.Code() == "ListenerNotFound"
}

func validateLbListenerActionType() schema.SchemaValidateFunc {
return validation.StringInSlice([]string{
elbv2.ActionTypeEnumForward,
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_lb_listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func testAccCheckAWSLBListenerDestroy(s *terraform.State) error {
}

// Verify the error
if isListenerNotFound(err) {
if isAWSErr(err, elbv2.ErrCodeListenerNotFoundException, "") {
return nil
} else {
return errwrap.Wrapf("Unexpected error checking LB Listener destroyed: {{err}}", err)
Expand Down

0 comments on commit 6c67b85

Please sign in to comment.