terraform-aws-modules / terraform-aws-apigateway-v2

Terraform module to create AWS API Gateway v2 (HTTP/WebSocket) 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/apigateway-v2/aws
Apache License 2.0
144 stars 188 forks source link

Examples are not working due to missing throttling configurations #13

Closed mtyurt closed 3 years ago

mtyurt commented 3 years ago

I'm testing this with terraform 0.14.3, aws provider 3.19.0, and the module version 0.5.0.

After applying the examples, I have received the response:

HTTP/1.1 429 Too Many Requests
{
    "message": "Too Many Requests"
}

Then I changed the throttling configuration manually through the WEB console, to see if it was going to work. The requests then returned 200 successfully. To see what was changed, I ran terraform plan, and here is the difference:

  ~ resource "aws_apigatewayv2_stage" "default" {
        id              = "$default"
        name            = "$default"
        # (7 unchanged attributes hidden)

      ~ default_route_settings {
          - throttling_burst_limit   = 100 -> null
          - throttling_rate_limit    = 100 -> null
            # (2 unchanged attributes hidden)
        }
        # (1 unchanged block hidden)
    }

I saw that the throttling configurations are commented out. Is this something expected? Am I missing a configuration here? Here is my configuration:

module "api_gateway" {
  source = "terraform-aws-modules/apigateway-v2/aws"

  name          = "http-lambda-example"
  description   = "HTTP API Gateway Template"
  protocol_type = "HTTP"

  cors_configuration = {
    allow_headers = ["content-type", "x-amz-date", "authorization", "x-api-key", "x-amz-security-token", "x-amz-user-agent"]
    allow_methods = ["*"]
    allow_origins = ["*"]
  }

  domain_name                 = "${local.subdomain}.${var.hosted_zone}"
  domain_name_certificate_arn = data.aws_acm_certificate.hosted_zone_certificate.arn

  default_stage_access_log_destination_arn = aws_cloudwatch_log_group.logs.arn
  default_stage_access_log_format          = "$context.identity.sourceIp - - [$context.requestTime] \"$context.httpMethod $context.routeKey $context.protocol\" $context.status $context.responseLength $context.requestId $context.integrationErrorMessage"

  integrations = {
    "ANY /" = {
      lambda_arn             = module.lambda_function.this_lambda_function_arn
      payload_format_version = "2.0"
      timeout_milliseconds   = 12000
    }

    "$default" = {
      lambda_arn = module.lambda_function.this_lambda_function_arn
    }
  }

}
davidkarlsen commented 3 years ago

Fixed in #30 / #32.

davidkarlsen commented 3 years ago

@antonbabenko I think this can be closed with the latest fixes now added.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.