From c62d38d57cf95b3d542839948a1adba8644250dc Mon Sep 17 00:00:00 2001 From: Vahe Sahakyan Date: Wed, 6 Jun 2018 11:35:21 +0200 Subject: [PATCH] Suppress errors when codecommit repository doesn't exists --- aws/resource_aws_codecommit_repository.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_codecommit_repository.go b/aws/resource_aws_codecommit_repository.go index 365fb29a86b..57cdfb4a3e8 100644 --- a/aws/resource_aws_codecommit_repository.go +++ b/aws/resource_aws_codecommit_repository.go @@ -112,7 +112,13 @@ func resourceAwsCodeCommitRepositoryRead(d *schema.ResourceData, meta interface{ out, err := conn.GetRepository(input) if err != nil { - return fmt.Errorf("Error reading CodeCommit Repository: %s", err.Error()) + if isAWSErr(err, codecommit.ErrCodeRepositoryDoesNotExistException, "") { + log.Printf("[WARN] CodeCommit Repository (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } else { + return fmt.Errorf("Error reading CodeCommit Repository: %s", err.Error()) + } } d.Set("repository_id", out.RepositoryMetadata.RepositoryId)