Do not fail on non-existent pipeline (#14431)

This commit is contained in:
Andres Koetsier 2017-05-12 15:14:07 +02:00 committed by Paul Stack
parent 6c5af927ac
commit 3266da055a
1 changed files with 8 additions and 0 deletions

View File

@ -2,10 +2,12 @@ package aws
import ( import (
"fmt" "fmt"
"log"
"os" "os"
"time" "time"
"github.com/aws/aws-sdk-go/aws" "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/aws/aws-sdk-go/service/codepipeline"
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
@ -441,6 +443,12 @@ func resourceAwsCodePipelineRead(d *schema.ResourceData, meta interface{}) error
}) })
if err != nil { 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) return fmt.Errorf("[ERROR] Error retreiving Pipeline: %q", err)
} }
pipeline := resp.Pipeline pipeline := resp.Pipeline