From 2297ac8087115aeddd356f9e9c881a726e9957ae Mon Sep 17 00:00:00 2001 From: Mohamed Nur <85885638+mohamed-cds@users.noreply.github.com> Date: Thu, 17 Mar 2022 10:01:10 -0400 Subject: [PATCH] feat: use lambda layer and newrelic lambda handler wrapper (#415) * feat: use lambda layer and cloudwatch for newrelic logs * feat: send to cloudwatch for now * chore: remove lambda layer integration * chore: remove layer * feat: go back to layer and wrapping the handler * chore: remove layer * chore: more envs * chore: remove duplicate env --- aws/lambda-api/lambda.tf | 5 ++++- aws/lambda-api/variables.tf | 4 ++++ env/terragrunt.hcl | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/aws/lambda-api/lambda.tf b/aws/lambda-api/lambda.tf index 7f34a376a..7670900ca 100644 --- a/aws/lambda-api/lambda.tf +++ b/aws/lambda-api/lambda.tf @@ -20,7 +20,6 @@ resource "aws_lambda_function" "api" { ] subnet_ids = var.vpc_private_subnets } - environment { variables = { ADMIN_CLIENT_SECRET = var.admin_client_secret @@ -34,10 +33,14 @@ resource "aws_lambda_function" "api" { DOCUMENTS_BUCKET = var.documents_bucket ENVIRONMENT = var.env MLWR_HOST = var.mlwr_host + NEW_RELIC_LAMBDA_HANDLER = "application.handler" + NEW_RELIC_ACCOUNT_ID = var.new_relic_account_id NEW_RELIC_APP_NAME = var.new_relic_app_name NEW_RELIC_DISTRIBUTED_TRACING_ENABLED = var.new_relic_distribution_tracing_enabled NEW_RELIC_LICENSE_KEY = var.new_relic_license_key NEW_RELIC_MONITOR_MODE = var.new_relic_monitor_mode + NEW_RELIC_EXTENSION_LOGS_ENABLED = true + NEW_RELIC_LAMBDA_EXTENSION_ENABLED = true NOTIFICATION_QUEUE_PREFIX = var.notification_queue_prefix NOTIFY_EMAIL_DOMAIN = var.domain NOTIFY_ENVIRONMENT = var.env diff --git a/aws/lambda-api/variables.tf b/aws/lambda-api/variables.tf index e5bd4a43f..a671166bc 100644 --- a/aws/lambda-api/variables.tf +++ b/aws/lambda-api/variables.tf @@ -149,6 +149,10 @@ locals { api_lambda_log_group = "/aws/lambda/api-lambda" } +variable "new_relic_account_id" { + type = string +} + variable "ff_batch_insertion" { type = bool } diff --git a/env/terragrunt.hcl b/env/terragrunt.hcl index c58b581db..711db9d48 100644 --- a/env/terragrunt.hcl +++ b/env/terragrunt.hcl @@ -12,6 +12,7 @@ inputs = { elb_account_ids = { "ca-central-1" = "985666609251" } + new_relic_account_id = "2691974" } generate "provider" {