aws_api_gateway_integration
Provides an HTTP Method Integration for an API Gateway Resource.
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"
}
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
)type
- (Required) The integration input’s type (HTTP, MOCK, AWS, AWS_PROXY, HTTP_PROXY)uri
- (Optional) The input’s URI (HTTP, AWS). Required iftype
isHTTP
orAWS
. For HTTP integrations, the URI must be a fully formed, encoded HTTP(S) URL according to the RFC-3986 specification . For AWS integrations, the URI should be of the formarn:aws:apigateway:{region}:{subdomain.service|service}:{path|action}/{service_api}
.region
,subdomain
andservice
are used to determine the right endpoint. e.g.arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:012345678901:function:my-func/invocations
credentials
- (Optional) The credentials required for the integration. ForAWS
integrations, 2 options are available. To specify an IAM Role for Amazon API Gateway to assume, use the role’s ARN. To require that the caller’s identity be passed through from the request, specify the stringarn:aws:iam::\*:user/\*
.integration_http_method
- (Optional) The integration HTTP method (GET
,POST
,PUT
,DELETE
,HEAD
,OPTION
). Required iftype
isAWS
orHTTP
. Not all methods are compatible with allAWS
integrations. e.g. Lambda function can only be invoked viaPOST
.request_templates
- (Optional) A map of the integration’s request templates.request_parameters
- (Optional) A map of request query string parameters and headers that should be passed to the backend responder. For example:request_parameters = { "integration.request.header.X-Some-Other-Header" = "method.request.header.X-Some-Header" }
passthrough_behavior
- (Optional) The integration passthrough behavior (WHEN_NO_MATCH
,WHEN_NO_TEMPLATES
,NEVER
). Required ifrequest_templates
is used.request_parameters_in_json
- Deprecated, userequest_parameters
instead.
See the source of this document at Terraform.io