gifted-gigabyte-53859
08/23/2024, 5:01 AMCustom access logging
where you define your format
However, in Pulumi stage resource properties there is only destinationArn
and format
. And even when I supply a destinationArn (have tested both creating the log group myself and referencing its arn, or simply contructing an arn string and letting API gateway create the log group) this doesn't enable the "CloudWatch logs" setting which remains on 'disabled' after pulumi up.
The Detailed metrics
option is also missing from the pulumi provider as is x-ray tracing
Am I missing something?gifted-gigabyte-53859
08/23/2024, 7:11 AMdefaultRouteSettings: # v2
- httpMethod: /\*/\*
loggingLevel: INFO
# detailedMetricsEnabled: True
metricsEnabled: True
dataTraceEnabled: True
but unfortunately it seems that apigatewayv2 is actually a different kind of aws service, only for websockets, and not simply v2 of the pulumi provider.
So I cannot use that.
I'm now trying in aws-native which allows overriding method settings
methodSettings:
- httpMethod: /\*/\*
loggingLevel: INFO
# detailedMetricsEnabled: True
metricsEnabled: True
dataTraceEnabled: True
modern-zebra-45309
08/23/2024, 2:15 PMgifted-gigabyte-53859
08/24/2024, 7:15 AMapigateway
provider. The apigatewayv2
provider has it, but apparently that's only for websockets apis.
I ended up getting it working using the aws-native
provider.
# tried using v2 since the properties are just not present on the v1 provider resource. but v2 is for websockets only apparently not http api
api_payments_secondStage:
# type: aws:apigateway:Stage # v1
# type: aws:apigatewayv2:Stage # v2
type: aws-native:apigateway:Stage # native
options: {}
properties:
# deployment: ${api_payments.deployment} # v1
deploymentId: ${api_payments.deployment} # native
# autoDeploy: True # v2 setting
# restApi: ${api_payments.api.id} # v1
# apiId: ${api_payments.api.id} # v2
restApiId: ${api_payments.api.id} # native
stageName: ${pulumi.stack}_native_active # v1 and native
# name: ${api_payments.stage.stageName}_active # v2
# defaultRouteSettings: # v2
methodSettings:
- resourcePath: "/*"
httpMethod: "*"
loggingLevel: INFO
# detailedMetricsEnabled: True
metricsEnabled: True
dataTraceEnabled: True
# accessLogSettings: # v1, v2
accessLogSetting: # native
destinationArn: ${lg_api_gateway_payments.arn}
# destinationArn: arn:aws:logs:ap-southeast-1:${varCurrentAwsAccountId}:log-group:API-Gateway-PinConfigured-LogGroup_${api_payments.api.id}/${pulumi.stack}
# Format from <https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html?icmpid=apigateway_console_help#apigateway-cloudwatch-log-formats>
format: '{ "requestId":"$context.requestId", "extendedRequestId":"$context.extendedRequestId","ip": "$context.identity.sourceIp", "caller":"$context.identity.caller", "user":"$context.identity.user", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod", "resourcePath":"$context.resourcePath", "status":"$context.status", "protocol":"$context.protocol", "responseLength":"$context.responseLength" }'
description: ${pulumi.stack}
tags:
- key: Environment # native
value: ${pulumi.stack} # native
# Environment: ${pulumi.stack} # v1 and v2
# CreatedBy: pulumi # v1 and v2
sticky-bear-14421
08/24/2024, 2:55 PM