I have this Terraform code:
resource "aws_api_gateway_method" "proxy" {
rest_api_id = aws_api_gateway_rest_api.dlx_mdm.id
resource_id = aws_api_gateway_resource.proxy.id
http_method = "ANY"
authorization = "CUSTOM"
authorizer_id = aws_api_gateway_authorizer.dlx_mdm_authorizer.id
request_parameters = {
"method.request.path.proxy" = true
}
}
resource "aws_api_gateway_stage" "mdm_stage" {
depends_on = [aws_cloudwatch_log_group.mdm_stage_log_group]
stage_name = "${local.stage_name}"
rest_api_id = aws_api_gateway_rest_api.dlx_mdm.id
deployment_id = aws_api_gateway_deployment.mdm_deployment.id
}
resource "aws_api_gateway_method_settings" "method_settings" {
rest_api_id = aws_api_gateway_rest_api.dlx_mdm.id
stage_name = aws_api_gateway_stage.mdm_stage.stage_name
method_path = "*/*"
settings {
data_trace_enabled = true
metrics_enabled = true
logging_level = "INFO"
caching_enabled = false
}
}
The resulting API Gateway method request looks like this:
This is the stage:
The issue is that I am unable to turn off the cache setting. Does anyone know how to control this? Publishing the API does not help.
I have this Terraform code:
resource "aws_api_gateway_method" "proxy" {
rest_api_id = aws_api_gateway_rest_api.dlx_mdm.id
resource_id = aws_api_gateway_resource.proxy.id
http_method = "ANY"
authorization = "CUSTOM"
authorizer_id = aws_api_gateway_authorizer.dlx_mdm_authorizer.id
request_parameters = {
"method.request.path.proxy" = true
}
}
resource "aws_api_gateway_stage" "mdm_stage" {
depends_on = [aws_cloudwatch_log_group.mdm_stage_log_group]
stage_name = "${local.stage_name}"
rest_api_id = aws_api_gateway_rest_api.dlx_mdm.id
deployment_id = aws_api_gateway_deployment.mdm_deployment.id
}
resource "aws_api_gateway_method_settings" "method_settings" {
rest_api_id = aws_api_gateway_rest_api.dlx_mdm.id
stage_name = aws_api_gateway_stage.mdm_stage.stage_name
method_path = "*/*"
settings {
data_trace_enabled = true
metrics_enabled = true
logging_level = "INFO"
caching_enabled = false
}
}
The resulting API Gateway method request looks like this:
This is the stage:
The issue is that I am unable to turn off the cache setting. Does anyone know how to control this? Publishing the API does not help.
Share Improve this question edited Nov 20, 2024 at 17:33 rboarman asked Nov 20, 2024 at 17:14 rboarmanrboarman 8,2149 gold badges60 silver badges91 bronze badges 4 |1 Answer
Reset to default 0You will need to enable API Gateway cluster cache, too, in aws_api_gateway_stage
:
variable "api_gateway_cache_cluster_enabled" {
default = "true"
}
variable "api_gateway_cache_cluster_size" {
default = "0.5"
}
resource "aws_api_gateway_stage" "mdm_stage" {
depends_on = [aws_cloudwatch_log_group.mdm_stage_log_group]
cache_cluster_enabled = var.api_gateway_cache_cluster_enabled
cache_cluster_size = var.api_gateway_cache_cluster_size
stage_name = local.stage_name
rest_api_id = aws_api_gateway_rest_api.dlx_mdm.id
deployment_id = aws_api_gateway_deployment.mdm_deployment.id
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742341931a4425800.html
Whether responses should be cached and returned for requests. A cache cluster must be enabled on the stage for responses to be cached.
. – Marko E Commented Nov 20, 2024 at 21:35