providers/aws: cloudfront distribution 404 should mark as gone (#10281)
This commit is contained in:
parent
5b71b40f93
commit
e014cf3d83
|
@ -6,6 +6,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/service/cloudfront"
|
||||
"github.com/hashicorp/errwrap"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
|
@ -527,6 +528,12 @@ func resourceAwsCloudFrontDistributionRead(d *schema.ResourceData, meta interfac
|
|||
|
||||
resp, err := conn.GetDistribution(params)
|
||||
if err != nil {
|
||||
if errcode, ok := err.(awserr.Error); ok && errcode.Code() == "NoSuchDistribution" {
|
||||
log.Printf("[WARN] No Distribution found: %s", d.Id())
|
||||
d.SetId("")
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue