I was trying one POC in the below scenario using was terraform api_gateway.
path= /demo/user(GET) -> invoke lamda function (hello).
path= /demo/user/{id)(put) -> invoke lamda function (test).
so here i have create the below resource
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 = "demo"
}
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 = "AWS_PROXY"
uri = "<lambda function arn>/invocation"
}
in terraform apply it is creating resource under /demo
but here how do I achieve the path?
path= /demo/user(GET) -> invoke lamda function (hello).
path= /demo/user/{id)(PUT) -> invoke lamda function (test).
Any comment will be highly appreciated.