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

default_route_settings 429 (Too Many Requests) #59

Closed Glen-Moonpig closed 2 years ago

Glen-Moonpig commented 2 years ago

Description

Please provide a clear and concise description of the issue you are encountering, your current setup, and what steps led up to the issue. If you can provide a reproduction, that will help tremendously.

I added this to get the detailed metrics:

default_route_settings = {
  detailed_metrics_enabled = true
}

Requests to the API Gateway now fail with 429 (Too Many Requests). I expect this is because the throttling_burst_limit and throttling_rate_limit have defaulted to 0.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

Reproduction

Use this configuration

default_route_settings = {
  detailed_metrics_enabled = true
}

Code Snippet to Reproduce

default_route_settings = {
  detailed_metrics_enabled = true
}

Expected behavior

I get the detailed metics and throttling defaults to API Gateway defaults.

Actual behavior

It seems throttling is defaulted to 0?

Terminal Output Screenshot(s)

Additional context

Glen-Moonpig commented 2 years ago

There is also an issue with subsequent deployments that have the default_route_settings completely removed. The API Gateway now has throttling stuck on 0 and can't go back to 'Unconfigured'. I think I need to delete the whole API Gateway and redeploy.

cojack commented 2 years ago

Same problem here, at the end I end up without using any part of this group:

data_trace_enabled
detailed_metrics_enabled
logging_level

Because looks like these values are wrong:

      throttling_burst_limit   = lookup(default_route_settings.value, "throttling_burst_limit", null)
      throttling_rate_limit    = lookup(default_route_settings.value, "throttling_rate_limit", null)
bryantbiggs commented 2 years ago

throttling_burst_limit and throttling_rate_limit default to null because they are optional parameters. if no value is provided then the AWS API will provide its own default - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_stage#throttling_burst_limit

bryantbiggs commented 2 years ago

~see https://github.com/hashicorp/terraform-provider-aws/issues/5690 - you may want to set these values to "-1"~

see https://github.com/hashicorp/terraform-provider-aws/issues/14742

cojack commented 2 years ago

@bryantbiggs please reopen this issue, because you don't even tried your solution and you are pointing ppl to wrong and not working approach, you are not able to set these values to -1.

bryantbiggs commented 2 years ago

@cojack - you are correct on my previous mis-statement regarding setting "-1", however there isn't anything we can do to alleviate this in this module, its is completely on the AWS API side https://github.com/hashicorp/terraform-provider-aws/issues/14742

cojack commented 2 years ago

I will be glad if this issue will remain open, until hashicorp fix it on their side, thanks in advance.

bryantbiggs commented 2 years ago

it is not a Terraform issue, its is an AWS API issue. Once AWS provides a means to mitigate this issue, then the Terraform AWS provider must update and finally we can update (if needed, sometimes for fixes like this there are no module changes required) - AWS > Terraform AWS > module

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.