I am getting issue in policy document length breaking Cloudwatch Logs Constraints in terraform. Is there any solution for this specific problem?


This Content is from Stack Overflow. Question asked by Abhishek Jha

resource "aws_apigatewayv2_stage" "main" {
  api_id      = aws_apigatewayv2_api.main.id
  name        = contains(["dev", "qa", "prod"], var.environment) ? "$default" : "${var.environment}"
  auto_deploy = true
  access_log_settings {
    destination_arn = resource.aws_cloudwatch_log_group.api_gateway.arn
    format          = "{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","routeKey":"$context.routeKey", "status":"$context.status","protocol":"$context.protocol", "responseLength:"$context.responseLength" }"

Error: error creating API Gateway v2 stage: BadRequestException: Cannot enable logging. Policy document length breaking Cloudwatch Logs Constraints, either < 1 or > 5120

resource "aws_apigatewayv2_stage" "main" {


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?