I would like to enable execution logging on an aws_apigatewayv2_api
resource. I can simply click the below checkbox to do so.
Since I know it is possible via AWS GUI, what is the terraform equivalent?
I already have logging enabled on each individual integration lambda, but this checkbox stays unchecked.
This setting is on the stage itself ie aws_apigatewayv2_stage
under the default_route_settings
argument.
To replicate the UI:
Enable CloudWatch Logs & Log level - these 2 options are combined in Terraform under logging_level
. Logging is disabled by default as logging_level
is set to OFF
. To enable logging, you will need to simply specify the logging_level
to any other supported value other than OFF
, which has the effect of turning logging on & setting the level at the same time.
Log full message data - this is in Terraform under detailed_metrics_enabled
.
This results in the below config:
resource "aws_apigatewayv2_stage" "example" {
api_id = aws_apigatewayv2_api.example.id
name = "example-stage"
default_route_settings {
logging_level = "INFO"
detailed_metrics_enabled = true
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.