Manages an Amazon API Gateway Version 2 route response. More information can be found in the Amazon API Gateway Developer Guide.
resource "aws_apigatewayv2_route_response" "example" {
api_id = aws_apigatewayv2_api.example.id
route_id = aws_apigatewayv2_route.example.id
route_response_key = "$default"
}
For websocket routes that require two-way communication enabled, an aws_apigatewayv2_route_response
needs to be added to the route with route_response_key = "$default"
. More information available is available in Amazon API Gateway Developer Guide.
You can only define the $default route response for WebSocket APIs. You can use an integration response to manipulate the response from a backend service. For more information, see Overview of integration responses.
This resource supports the following arguments:
api_id
- (Required) API identifier.route_id
- (Required) Identifier of the aws_apigatewayv2_route
.route_response_key
- (Required) Route response key.model_selection_expression
- (Optional) The model selection expression for the route response.response_models
- (Optional) Response models for the route response.This resource exports the following attributes in addition to the arguments above:
id
- Route response identifier.In Terraform v1.5.0 and later, use an import
block to import aws_apigatewayv2_route_response
using the API identifier, route identifier and route response identifier. For example:
import {
to = aws_apigatewayv2_route_response.example
id = "aabbccddee/1122334/998877"
}
Using terraform import
, import aws_apigatewayv2_route_response
using the API identifier, route identifier and route response identifier. For example:
% terraform import aws_apigatewayv2_route_response.example aabbccddee/1122334/998877