amazon-web-services - 如何通过 Terraform 描述 API Gateway 资源?
问题描述
我正在尝试使用该ANY
方法用 Terraform 描述我的 API 网关资源。我有:
/{accountId}/{accountType}/ANY
集成类型为 Lambda 函数并启用 Lambda 代理集成。
到目前为止,我有这个:
resource "aws_api_gateway_rest_api" "apiLambda" {
name = "account-api-proxy-main"
description = "Proxy to handle requests to the Account service lambda"
}
resource "aws_api_gateway_resource" "accountIdResource" {
rest_api_id = aws_api_gateway_rest_api.apiLambda.id
parent_id = aws_api_gateway_rest_api.apiLambda.root_resource_id
path_part = "{accountId}"
}
resource "aws_api_gateway_resource" "accountTypeResource" {
rest_api_id = aws_api_gateway_rest_api.apiLambda.id
parent_id = aws_api_gateway_resource.accountIdResource.id
path_part = "{accountType}"
}
resource "aws_api_gateway_method" "any_method" {
rest_api_id = aws_api_gateway_rest_api.apiLambda.id
resource_id = aws_api_gateway_resource.accountTypeResource.id
http_method = "ANY"
authorization = "NONE"
request_parameters = {
"method.request.path.accountId" = true
"method.request.path.accountType" = true
}
}
我不太确定如何描述 lambda 函数集成以及 lambda 代理集成......任何指针?我通过控制台创建了 API 网关,一切正常,但我现在正尝试通过 terraform 重新创建所有配置。
解决方案
推荐阅读
- bash - `bash` 正在泄漏内存,我在哪里报告它?
- reactjs - 在 useEffect 挂钩中使用对象属性而不是对象作为依赖项是不好的做法吗?
- bootstrap-5 - Bootstrap 5:如何添加 $font-family-serif 变量
- typescript - 带有 Expo 和 Typescript 的 NPM 工作区
- android - 代码已粘贴,但它在 Android SSH 客户端上执行了相反的行顺序
- vba - VBA 用户表单组合框是 Outlook 联系人姓名列表和命令按钮,用于在选择姓名时搜索匹配的联系人家庭电话号码
- javascript - 以闪亮的方式删除html表中的特定行
- python - 如何使用用户输入迭代地构建 pd 系列,一次一个单元格?
- flutter - 从 Flutter 中的异步方法中调用一个确定的值。等待问题
- mysql - .ibd 文件在 ubuntu 服务器上占用太多空间