Skip to content

API Gateway stage logging should be enabled

API Gateway logging displays detailed views of users who accessed the API and the way they accessed the API.

How to fix

Attribute access_log_settings[0].destination_arn of aws_api_gateway_stage must be non-empty.

Implementation options

Choose the option that matches how you manage Terraform. All options satisfy this control.

Option 1: Terraform AWS provider resources

If you manage resources directly, configure the relevant Terraform AWS provider resources to meet this control. See docs for the resources involved: aws_api_gateway_stage.

resource "aws_api_gateway_rest_api" "this" {
  name = "pofix-example-api"
}

resource "aws_api_gateway_stage" "this" {
  access_log_settings {
    destination_arn = "arn:aws:logs:us-east-1:123456789012:log-group:example-log-group"
    format          = "$context.requestId"
  }
  client_certificate_id = "abc123"
  deployment_id         = "abc123"
  rest_api_id           = "abc123"
  stage_name            = "example"
}
Which option should I choose?
  • Compliance.tf module (recommended): controls enforced by default and mapped to frameworks.
  • Open source module (terraform-aws-modules): compatible by design with compliance.tf. Same variable names for an easy, low-change migration path when you are ready.
  • Terraform AWS provider resources: manage Terraform resources directly.

Tool mappings

Use these identifiers to cross-reference this control across tools, reports, and evidence.

  • Compliance.tf (CTF) Control: apigateway_stage_logging_enabled

  • AWS Config Managed Rules: APIGATEWAY_STAGE_ACCESS_LOGS_ENABLED, API_GW_EXECUTION_LOGGING_ENABLED

  • Checkov Check: CKV2_AWS_4

  • Powerpipe Controls: aws_compliance.control.apigateway_stage_logging_enabled, aws_compliance.control.gatewayv2_stage_access_logging_enabled