From fca289ad6a634aa39b88948e6753da84c797349a Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Mon, 3 Jun 2024 14:03:42 +0300 Subject: [PATCH 1/3] up quotas more after seeing usage history --- terraform/modules/api_gateway/gateway/variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/modules/api_gateway/gateway/variables.tf b/terraform/modules/api_gateway/gateway/variables.tf index 9461370d9..ae8a468b0 100644 --- a/terraform/modules/api_gateway/gateway/variables.tf +++ b/terraform/modules/api_gateway/gateway/variables.tf @@ -51,12 +51,12 @@ variable "api_gateway_usage_plans" { description = "Throttling limits for API Gateway" default = { internal_apps = { - quota_limit = 50000 # per day + quota_limit = 500000 # per day burst_limit = 1000 rate_limit = 200 # per second } external_apps = { - quota_limit = 1000 + quota_limit = 10000 burst_limit = 20 rate_limit = 10 } From 2f7be137f6dea1c5a0dd33391745ff90c5fbded9 Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Mon, 3 Jun 2024 14:18:30 +0300 Subject: [PATCH 2/3] dont ignore changes since we dont use manual method level throttling --- terraform/modules/api_gateway/gateway/main.tf | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/terraform/modules/api_gateway/gateway/main.tf b/terraform/modules/api_gateway/gateway/main.tf index 5f3e8a6af..ffbed1516 100644 --- a/terraform/modules/api_gateway/gateway/main.tf +++ b/terraform/modules/api_gateway/gateway/main.tf @@ -180,13 +180,6 @@ resource "aws_api_gateway_usage_plan" "internal" { burst_limit = var.api_gateway_usage_plans.internal_apps.burst_limit rate_limit = var.api_gateway_usage_plans.internal_apps.rate_limit } - - # terraform doesn't expose API Gateway's method level throttling so will do that - # manually and this will stop terraform from destroying the manual changes - # Open PR to add the feature to terraform: https://github.com/hashicorp/terraform-provider-aws/pull/20672 - lifecycle { - ignore_changes = all - } } resource "aws_api_gateway_usage_plan" "external" { @@ -206,14 +199,6 @@ resource "aws_api_gateway_usage_plan" "external" { burst_limit = var.api_gateway_usage_plans.external_apps.burst_limit rate_limit = var.api_gateway_usage_plans.external_apps.rate_limit } - - # terraform doesn't expose API Gateway's method level throttling so will do that - # manually and this will stop terraform from destroying the manual changes - # Open PR to add the feature to terraform: https://github.com/hashicorp/terraform-provider-aws/pull/20672 - lifecycle { - ignore_changes = all - } - } resource "aws_api_gateway_deployment" "api_gw_dep" { From b233d1368e8194f7b035531ca09bb8462545831f Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Mon, 3 Jun 2024 14:18:50 +0300 Subject: [PATCH 3/3] add contact email in rate limiting errors --- terraform/modules/api_gateway/resource/main.tf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/terraform/modules/api_gateway/resource/main.tf b/terraform/modules/api_gateway/resource/main.tf index 6eba66851..7c1023ae6 100644 --- a/terraform/modules/api_gateway/resource/main.tf +++ b/terraform/modules/api_gateway/resource/main.tf @@ -17,8 +17,8 @@ resource "aws_api_gateway_integration" "get_endpoint_integration" { http_method = aws_api_gateway_method.get_endpoint_method.http_method type = "MOCK" - passthrough_behavior = "WHEN_NO_MATCH" - request_templates = { + passthrough_behavior = "WHEN_NO_MATCH" + request_templates = { "application/json" : <