我想像下面的https://exampleapi.com/dev?account_id=12345一样在API中传递account_id
这是创建aws api网关的地形片段:
resource "aws_api_gateway_method" "example_api_method" {
rest_api_id = "${aws_api_gateway_rest_api.example_api.id}"
resource_id = "${aws_api_gateway_resource.example_api_resource.id}"
http_method = "GET"
authorization = "NONE"
}
resource "aws_api_gateway_integration" "example_api_method-integration" {
rest_api_id = "${aws_api_gateway_rest_api.example_api.id}"
resource_id = "${aws_api_gateway_resource.example_api_resource.id}"
http_method = "${aws_api_gateway_method.example_api_method.http_method}"
type = "AWS"
uri = "arn:aws:apigateway:${var.aws_region}:lambda:path/functions/${var.lambda_arn}/invocations"
integration_http_method = "GET"
}
提前致谢。
最佳答案
resource "aws_api_gateway_method" "example_api_method" {
rest_api_id = "${aws_api_gateway_rest_api.example_api.id}"
resource_id = "${aws_api_gateway_resource.example_api_resource.id}"
http_method = "GET"
authorization = "NONE"
request_parameters = {
"integration.request.querystring.account_id"=true
}
}
有关更多信息,请参见https://www.terraform.io/docs/providers/aws/r/api_gateway_method.html上的aws_api_gateway_method资源的request_parameters字段