while creating simple aws http api using terraform I couldn't get right approach/ precise parameter to api integration scipt(aws_apigatewayv2_integration) and api route (aws_apigatewayv2_route)
As shown below [Image for creating http api routes through aws console][1]
[Image for creating Integration through aws console][2]
I could'nt find precise way to do all these stuff using terraform script.
Here are main issues:
resource "aws_apigatewayv2_api" "api_b" {
name = "api_b"
protocol_type = "HTTP"
}
resource "aws_apigatewayv2_integration" "testapi" {
api_id = "${aws_apigatewayv2_api.api_b.id}"
integration_type = "AWS_PROXY"
connection_type = "INTERNET"
description = "Lambda example"
integration_method = "POST"
integration_uri = "${aws_lambda_function.test_lambda.arn}"
}
resource "aws_apigatewayv2_route" "example" {
api_id = "${aws_apigatewayv2_api.api_b.id}"
route_key = "$default"
operation_name = "ConnectRoute"
target = "integrations/${aws_apigatewayv2_integration.testapi.id}"
}
As per official documentaion of terraform aws_apigatewayv2_route the target parameter is not well specified: https://www.terraform.io/docs/providers/aws/r/apigatewayv2_route.html#target
Hence Kindly give me code / specific syntax for target, route_key.
Thanks in Advance [1]: https://i.stack.imgur.com/xx8rx.png [2]: https://i.stack.imgur.com/I7WJP.png