小编Har*_* KM的帖子

Terraform:根据用户输入在 AWS API Gateway 中动态生成 REST API 端点

我正在构建一个 Terraform 模块,该模块在 AWS API Gateway 中部署 REST API。该模块的用户将提供如下输入:

api_resources = {
    resource1 = {
        api_endpoint = "/pets/{petID}"
        http_method = "GET"
    },
    resource2 = {
        api_endpoint = "/pets"
        http_method = "GET"
    },
    resource3 = {
        api_endpoint = "/toys"
        http_method = "GET"
    },
    resource4 = {
        api_endpoint = "/pets"
        http_method = "POST"
    }
}

Run Code Online (Sandbox Code Playgroud)

在我的模块中,将使用 Terraform 资源部署此输入aws_api_gateway_resource。它需要以下参数:

resource "aws_api_gateway_resource" "resource" {
  rest_api_id = # ID of the parent REST API resource.
  parent_id   = # ID of the immediate parent …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services terraform aws-api-gateway

4
推荐指数
1
解决办法
1930
查看次数