@@ -47,7 +47,7 @@ resource "aws_api_gateway_deployment" "ndr_api_deploy" {
4747 module . access-audit-lambda ,
4848 module . back-channel-logout-gateway ,
4949 module . back_channel_logout_lambda ,
50- module . create-doc-ref-gateway ,
50+ module . document_reference_gateway ,
5151 module . create-doc-ref-lambda ,
5252 module . create-token-gateway ,
5353 module . create-token-lambda ,
@@ -91,7 +91,28 @@ resource "aws_api_gateway_stage" "ndr_api" {
9191 deployment_id = aws_api_gateway_deployment. ndr_api_deploy . id
9292 rest_api_id = aws_api_gateway_rest_api. ndr_doc_store_api . id
9393 stage_name = var. environment
94- xray_tracing_enabled = false
94+ xray_tracing_enabled = var. enable_xray_tracing
95+
96+ depends_on = [aws_cloudwatch_log_group . api_gateway_stage ]
97+ }
98+
99+ resource "aws_cloudwatch_log_group" "api_gateway_stage" {
100+ # Name must follow this format to allow execution logging
101+ # https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html
102+ name = " API-Gateway-Execution-Logs_${ aws_api_gateway_rest_api . ndr_doc_store_api . id } /${ var . environment } "
103+ retention_in_days = 0
104+ }
105+
106+ resource "aws_api_gateway_method_settings" "api_gateway_stage" {
107+ rest_api_id = aws_api_gateway_rest_api. ndr_doc_store_api . id
108+ stage_name = aws_api_gateway_stage. ndr_api . stage_name
109+ method_path = " */*"
110+
111+ settings {
112+ logging_level = " INFO"
113+ metrics_enabled = true
114+ data_trace_enabled = true
115+ }
95116}
96117
97118resource "aws_api_gateway_gateway_response" "unauthorised_response" {
@@ -110,6 +131,10 @@ resource "aws_api_gateway_gateway_response" "unauthorised_response" {
110131 }
111132}
112133
134+ resource "aws_api_gateway_client_certificate" "ndr_api" {
135+ description = " Client certificate used for backend authentication in HTTP integrations with the NDR API Gateway (${ var . environment } )"
136+ }
137+
113138resource "aws_api_gateway_gateway_response" "bad_gateway_response" {
114139 rest_api_id = aws_api_gateway_rest_api. ndr_doc_store_api . id
115140 response_type = " DEFAULT_5XX"
0 commit comments