diff --git a/builtin/providers/aws/resource_aws_api_gateway_integration.go b/builtin/providers/aws/resource_aws_api_gateway_integration.go index 90b2f3d24..62e6985b5 100644 --- a/builtin/providers/aws/resource_aws_api_gateway_integration.go +++ b/builtin/providers/aws/resource_aws_api_gateway_integration.go @@ -41,16 +41,9 @@ func resourceAwsApiGatewayIntegration() *schema.Resource { }, "type": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - if value != "MOCK" && value != "AWS" && value != "HTTP" && value != "AWS_PROXY" && value != "HTTP_PROXY" { - errors = append(errors, fmt.Errorf( - "%q must be one of 'AWS', 'MOCK', 'HTTP', 'AWS_PROXY', 'HTTP_PROXY'", k)) - } - return - }, + Type: schema.TypeString, + Required: true, + ValidateFunc: validateApiGatewayIntegrationType, }, "uri": &schema.Schema{ diff --git a/builtin/providers/aws/validators.go b/builtin/providers/aws/validators.go index bb65870f5..50af23f26 100644 --- a/builtin/providers/aws/validators.go +++ b/builtin/providers/aws/validators.go @@ -467,3 +467,12 @@ func validateJsonString(v interface{}, k string) (ws []string, errors []error) { } return } + +func validateApiGatewayIntegrationType(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if value != "MOCK" && value != "AWS" && value != "HTTP" && value != "AWS_PROXY" && value != "HTTP_PROXY" { + errors = append(errors, fmt.Errorf( + "%q must be one of 'AWS', 'MOCK', 'HTTP', 'AWS_PROXY', 'HTTP_PROXY'", k)) + } + return +}