Skip to content

Instantly share code, notes, and snippets.

@nbcchen
nbcchen / read-api-gateway.tf
Last active July 8, 2024 12:27
Read different stuff from Serverless stack in Terraform
variable "env" {
type = string
}
# Read API Gateway API
# The name is always {stageName}-{serviceName}, unless apiName is specified
# Doesn't work with nested stacks created by serverless-plugin-split-stacks
# https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml#api-gateway-v1-rest-api
data "aws_api_gateway_rest_api" "rest_api" {
functions:
function1:
tracing: Active
environment:
AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-handler'
layers:
- !Sub arn:aws:lambda:${AWS::Region}:901920570463:layer:aws-otel-nodejs-0-23-0:1 # https://github.com/aws-observability/aws-otel-lambda#aws-managed-opentelemetry-lambda-layers
foreach($_ in [System.TimeZoneInfo]::GetSystemTimeZones()){if($_.Id.StartsWith('Greenwich') -or $_.Id.StartsWith('GMT')){ echo $_ }}