【发布时间】:2020-10-20 09:42:10
【问题描述】:
我在本地运行 Terraform 0.12.24
我正在尝试部署与 Lambda 的 API Gateway 集成
我正在尝试使用 Terraform 启用 AWS API GW CORS。
我有以下资源用于 OPTIONS 方法响应:
resource "aws_api_gateway_method_response" "options_200" {
rest_api_id = aws_api_gateway_rest_api.scout-approve-api-gateway.id
resource_id = aws_api_gateway_resource.proxy.id
http_method = aws_api_gateway_method.options_method.http_method
status_code = "200"
response_models {
"application/json" = "Empty"
}
response_parameters {
"method.response.header.Access-Control-Allow-Headers" = true,
"method.response.header.Access-Control-Allow-Methods" = true,
"method.response.header.Access-Control-Allow-Origin" = true
}
depends_on = [aws_api_gateway_method.options_method]
}
我得到:
Error: Invalid argument name
on main.tf line 48, in resource "aws_api_gateway_method_response" "options_200":
48: "application/json" = "Empty"
Argument names must not be quoted.
什么给了?
【问题讨论】:
-
我在
https://github.com/mewa/terraform-aws-apigateway-cors/blob/master/main.tf和 medium.com/@MrPonath/terraform-and-aws-api-gateway-a137ee48a8ac 中看到相同的声明` 为什么它对我不起作用?
标签: amazon-web-services terraform aws-api-gateway terraform-provider-aws terraform0.12+