provider/aws: Guard APIGateway resource & REST API against deletion

This commit is contained in:
Radek Simko 2016-03-06 09:13:06 +00:00
parent 0c5a0f96c2
commit a338eae72a
2 changed files with 8 additions and 0 deletions

View File

@ -75,6 +75,10 @@ func resourceAwsApiGatewayResourceRead(d *schema.ResourceData, meta interface{})
})
if err != nil {
if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NotFoundException" {
d.SetId("")
return nil
}
return err
}

View File

@ -87,6 +87,10 @@ func resourceAwsApiGatewayRestApiRead(d *schema.ResourceData, meta interface{})
RestApiId: aws.String(d.Id()),
})
if err != nil {
if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NotFoundException" {
d.SetId("")
return nil
}
return err
}