指定請求模板用於aws_api_gateway_integration在Terraform documentation for AWS_API_GATEWAY_INTEGRATION,以下參數被支持:在terraform
- rest_api_id
- RESOURCE_ID
- http_method
- 類型
- URI
- integration_http_method
他們舉這個例子:
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"
}
但我想指定一個映射模板(以及一個lambda整合),你可以與UI:
然而Terraform沒有辦法做到這一點。有可能嗎?
注:什麼我目前做的是荷蘭國際集團apply
的其餘配置(拉姆達,S3,IAM等...),然後添加映射模板之後手動(以及拉姆達的整合型) 。
但是,每次我terraform apply
應用一些其他配置(例如:s3),Terraform恢復映射模板和集成類型。
的 「恢復」 計劃是這樣的:
~ aws_api_gateway_integration.post_hit_integration
request_templates.#: "1" => "0"
request_templates.application/json: "{\n \"body\" : $input.json('$'),\n \"headers\": {\n #foreach($param in $input.params().header.keySet())\n \"$param\": \"$util.escapeJavaScript($input.params().header.get($param))\" #if($foreach.hasNext),#end\n \n #end \n },\n \"stage\" : \"$context.stage\"\n}" => ""
uri: "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:000000000000:function:create_hit/invocations" => ""
我一直在到處找這個,非常感謝你。我正要詳盡地列舉頭文件。 – jstlaurent