From 755b643caf0089288a228f42729e0d68dc1c300a Mon Sep 17 00:00:00 2001 From: brookesargent Date: Fri, 13 Oct 2023 13:27:48 -0400 Subject: [PATCH] update provided.al2 runtime and the new binary format --- modules/rds-logs/main.tf | 5 +++-- modules/rds-logs/variables.tf | 22 ++++++++++++++++++++++ modules/s3-logfile/main.tf | 5 +++-- modules/s3-logfile/variables.tf | 16 ++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/modules/rds-logs/main.tf b/modules/rds-logs/main.tf index cd80a59..8013e28 100644 --- a/modules/rds-logs/main.tf +++ b/modules/rds-logs/main.tf @@ -36,14 +36,15 @@ module "rds_lambda_transform" { function_name = "${var.name}-honeycomb-rds-${var.db_engine}-log-parser" description = "Parses RDS logs coming off of Kinesis Firehose, sending them back to the Firehose as structured JSON events." handler = "rds-${var.db_engine}-kfh-transform" - runtime = "go1.x" + runtime = "provided.al2" + architectures = var.lambda_function_architecture == "amd64" ? ["x86_64"] : ["arm64"] memory_size = var.lambda_function_memory timeout = var.lambda_function_timeout create_package = false s3_existing_package = { bucket = coalesce(var.lambda_package_bucket, "honeycomb-integrations-${data.aws_region.current.name}") - key = coalesce(var.lambda_package_key, "agentless-integrations-for-aws/LATEST/ingest-handlers.zip") + key = coalesce(var.lambda_package_key, "agentless-integrations-for-aws/${var.agentless_integrations_version}/rds-${var.db_engine}-kfh-transform-${var.lambda_function_architecture}.zip") } attach_policy = true diff --git a/modules/rds-logs/variables.tf b/modules/rds-logs/variables.tf index 7556417..f77144f 100644 --- a/modules/rds-logs/variables.tf +++ b/modules/rds-logs/variables.tf @@ -133,6 +133,17 @@ variable "http_buffering_interval" { description = "Kinesis Firehose http buffer interval, in seconds." } +variable "lambda_function_architecture" { + type = string + default = "arm64" + description = "Instruction set architecture for your Lambda function." + validation { + condition = contains(["amd64", "arm64"], + var.lambda_function_architecture) + error_message = "Not an allowed Lambda architecture." + } +} + variable "lambda_function_memory" { type = number default = 192 @@ -162,3 +173,14 @@ variable "tags" { description = "Tags to add to resources created by this module." default = null } + +variable "agentless_integrations_version" { + type = string + description = "Version of https://github.com/honeycombio/agentless-integrations-for-aws to use. Default is LATEST, but note that specifying this does not automatically update the lambda to use the newest versions as they are released." + default = "LATEST" + + validation { + error_message = "Version must be at least 4.0.0" + condition = can(regex("^([4-9]|[1-9][0-9]+)\.[0-9]+\.[0-9]+$", var.agentless_integrations_version)) + } +} \ No newline at end of file diff --git a/modules/s3-logfile/main.tf b/modules/s3-logfile/main.tf index d4adafe..717ec46 100644 --- a/modules/s3-logfile/main.tf +++ b/modules/s3-logfile/main.tf @@ -42,14 +42,15 @@ module "s3_processor" { function_name = var.name description = "Parses LB access logs from S3, sending them to Honeycomb as structured events" handler = "s3-handler" - runtime = "go1.x" + runtime = "provided.al2" + architectures = var.lambda_function_architecture == "amd64" ? ["x86_64"] : ["arm64"] memory_size = var.lambda_function_memory timeout = var.lambda_function_timeout create_package = false s3_existing_package = { bucket = coalesce(var.lambda_package_bucket, "honeycomb-integrations-${data.aws_region.current.name}") - key = coalesce(var.lambda_package_key, "agentless-integrations-for-aws/${var.agentless_integrations_version}/ingest-handlers.zip") + key = coalesce(var.lambda_package_key, "agentless-integrations-for-aws/${var.agentless_integrations_version}/s3-handler-${var.lambda_function_architecture}.zip") } diff --git a/modules/s3-logfile/variables.tf b/modules/s3-logfile/variables.tf index e002fdc..50acc34 100644 --- a/modules/s3-logfile/variables.tf +++ b/modules/s3-logfile/variables.tf @@ -42,6 +42,17 @@ variable "kms_key_arn" { default = "" } +variable "lambda_function_architecture" { + type = string + default = "arm64" + description = "Instruction set architecture for your Lambda function." + validation { + condition = contains(["amd64", "arm64"], + var.lambda_function_architecture) + error_message = "Not an allowed Lambda architecture." + } +} + variable "lambda_function_memory" { type = number default = 192 @@ -136,4 +147,9 @@ variable "agentless_integrations_version" { type = string description = "Version of https://github.com/honeycombio/agentless-integrations-for-aws to use. Default is LATEST, but note that specifying this does not automatically update the lambda to use the newest versions as they are released." default = "LATEST" + + validation { + error_message = "Version must be at least 4.0.0" + condition = can(regex("^([4-9]|[1-9][0-9]+)\.[0-9]+\.[0-9]+$", var.agentless_integrations_version)) + } }