Skip to content

Commit

Permalink
provider/aws: Update state on aws_elasticache_subnet_group not foun…
Browse files Browse the repository at this point in the history
…d exception

Fixes hashicorp#7062

make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSElasticacheSubnetGroup'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSElasticacheSubnetGroup -timeout 120m
=== RUN   TestAccAWSElasticacheSubnetGroup_basic
--- PASS: TestAccAWSElasticacheSubnetGroup_basic (44.62s)
=== RUN   TestAccAWSElasticacheSubnetGroup_update
--- PASS: TestAccAWSElasticacheSubnetGroup_update (73.74s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	118.379s
  • Loading branch information
stack72 committed Jun 8, 2016
1 parent ac2d195 commit 2a09941
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func resourceAwsElasticacheSubnetGroupRead(d *schema.ResourceData, meta interfac

res, err := conn.DescribeCacheSubnetGroups(req)
if err != nil {
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "CacheSubnetGroupNotFoundFault" {
// Update state to indicate the db subnet no longer exists.
d.SetId("")
return nil
}
return err
}
if len(res.CacheSubnetGroups) == 0 {
Expand Down

0 comments on commit 2a09941

Please sign in to comment.