aws_api_gateway_integration_response
Provides an HTTP Method Integration Response for an API Gateway Resource.
-> Note: Depends on having aws_api_gateway_integration
inside your rest api. To ensure this
you might need to add an explicit depends_on
for clean runs.
Example Usage
resource "aws_api_gateway_rest_api" "MyDemoAPI" {
name = "MyDemoAPI"
description = "This is my API for demonstration purposes"
}
resource "aws_api_gateway_resource" "MyDemoResource" {
rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
parent_id = "${aws_api_gateway_rest_api.MyDemoAPI.root_resource_id}"
path_part = "mydemoresource"
}
resource "aws_api_gateway_method" "MyDemoMethod" {
rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
resource_id = "${aws_api_gateway_resource.MyDemoResource.id}"
http_method = "GET"
authorization = "NONE"
}
resource "aws_api_gateway_integration" "MyDemoIntegration" {
rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
resource_id = "${aws_api_gateway_resource.MyDemoResource.id}"
http_method = "${aws_api_gateway_method.MyDemoMethod.http_method}"
type = "MOCK"
}
resource "aws_api_gateway_method_response" "200" {
rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
resource_id = "${aws_api_gateway_resource.MyDemoResource.id}"
http_method = "${aws_api_gateway_method.MyDemoMethod.http_method}"
status_code = "200"
}
resource "aws_api_gateway_integration_response" "MyDemoIntegrationResponse" {
rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
resource_id = "${aws_api_gateway_resource.MyDemoResource.id}"
http_method = "${aws_api_gateway_method.MyDemoMethod.http_method}"
status_code = "${aws_api_gateway_method_response.200.status_code}"
}
Argument Reference
The following arguments are supported:
rest_api_id
- (Required) The ID of the associated REST APIresource_id
- (Required) The API resource IDhttp_method
- (Required) The HTTP method (GET
,POST
,PUT
,DELETE
,HEAD
,OPTION
,ANY
)status_code
- (Required) The HTTP status codeselection_pattern
- (Optional) Specifies the regular expression pattern used to choose an integration response based on the response from the backend. If the backend is anAWS
Lambda function, the AWS Lambda function error header is matched. For all otherHTTP
andAWS
backends, the HTTP status code is matched.response_templates
- (Optional) A map specifying the templates used to transform the integration response bodyresponse_parameters
- (Optional) A map of response parameters that can be read from the backend response. For example:response_parameters = { "method.response.header.X-Some-Header" = "integration.response.header.X-Some-Other-Header" }
,response_parameters_in_json
- Deprecated, useresponse_parameters
instead.
See the source of this document at Terraform.io