Skip to content

Commit

Permalink
Do not fail on non-existent pipeline (#14431)
Browse files Browse the repository at this point in the history
  • Loading branch information
AKoetsier authored and stack72 committed May 12, 2017
1 parent 6c5af92 commit 3266da0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions builtin/providers/aws/resource_aws_codepipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package aws

import (
"fmt"
"log"
"os"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/codepipeline"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
Expand Down Expand Up @@ -441,6 +443,12 @@ func resourceAwsCodePipelineRead(d *schema.ResourceData, meta interface{}) error
})

if err != nil {
pipelineerr, ok := err.(awserr.Error)
if ok && pipelineerr.Code() == "PipelineNotFoundException" {
log.Printf("[INFO] Codepipeline %q not found", d.Id())
d.SetId("")
return nil
}
return fmt.Errorf("[ERROR] Error retreiving Pipeline: %q", err)
}
pipeline := resp.Pipeline
Expand Down

0 comments on commit 3266da0

Please sign in to comment.