diff --git a/aws/resource_aws_api_gateway_usage_plan.go b/aws/resource_aws_api_gateway_usage_plan.go index 11f4d2dad5b..257e40311a6 100644 --- a/aws/resource_aws_api_gateway_usage_plan.go +++ b/aws/resource_aws_api_gateway_usage_plan.go @@ -235,7 +235,7 @@ func resourceAwsApiGatewayUsagePlanRead(d *schema.ResourceData, meta interface{} UsagePlanId: aws.String(d.Id()), }) if err != nil { - if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NotFoundException" { + if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == apigateway.ErrCodeNotFoundException { log.Printf("[WARN] API Gateway Usage Plan (%s) not found, removing from state", d.Id()) d.SetId("") return nil diff --git a/aws/resource_aws_api_gateway_usage_plan_test.go b/aws/resource_aws_api_gateway_usage_plan_test.go index 47036795eb7..ca440e0c645 100644 --- a/aws/resource_aws_api_gateway_usage_plan_test.go +++ b/aws/resource_aws_api_gateway_usage_plan_test.go @@ -414,7 +414,7 @@ func testAccCheckAWSAPIGatewayUsagePlanDestroy(s *terraform.State) error { if !ok { return err } - if aws2err.Code() != "NotFoundException" { + if aws2err.Code() != apigateway.ErrCodeNotFoundException { return err }