From 5d612b7ffcec4f905b9c2a3bb0864da4e22bde3b Mon Sep 17 00:00:00 2001 From: Marcio Goda Date: Thu, 23 May 2024 15:53:53 +0100 Subject: [PATCH] add architectures --- README.md | 2 ++ main.tf | 5 +---- variables.tf | 6 ++++++ versions.tf | 9 +++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 versions.tf diff --git a/README.md b/README.md index c70943f..48aef46 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ This module will deploy a Lambda function. It supports both Zip and Image deploy - `reserved_concurrent_executions` (number) - The amount of reserved concurrent executions for this lambda function. - `tags` (map) - A mapping of tags to assign to this lambda function. - `datadog_log_subscription_arn` - (string) - Log subscription arn for shipping logs to datadog. +- `architectures` - (list) - List of architectures to support for the Lambda function. ### Zip deployment variables - `runtime` - (string) - **REQUIRED** - The runtime environment for the Lambda function you are uploading. @@ -50,6 +51,7 @@ module "lambda" { timeout = 5 memory_size = 256 lambda_env = "${var.lambda_env}" + architectures = ["x86_64"] } ``` Lambda environment variables file: diff --git a/main.tf b/main.tf index 7f44b05..d6f0442 100644 --- a/main.tf +++ b/main.tf @@ -1,7 +1,3 @@ -terraform { - required_version = ">= 0.12" -} - resource "aws_lambda_function" "lambda_function" { image_uri = var.image_uri s3_bucket = var.s3_bucket @@ -16,6 +12,7 @@ resource "aws_lambda_function" "lambda_function" { tags = var.tags package_type = var.image_uri != null ? "Image" : "Zip" layers = var.layers + architectures = var.architectures dynamic "image_config" { for_each = var.image_uri != null ? [1] : [] diff --git a/variables.tf b/variables.tf index ba9422c..d2fe7b9 100644 --- a/variables.tf +++ b/variables.tf @@ -131,3 +131,9 @@ variable "layers" { description = "ARNs of the layers to attach to the lambda function in order" default = [] } + +variable "architectures" { + type = list(string) + description = "Lambda architectures to support." + default = ["x86_64"] +} \ No newline at end of file diff --git a/versions.tf b/versions.tf new file mode 100644 index 0000000..62c6021 --- /dev/null +++ b/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 0.12" + required_providers { + aws = { + source = "hashicorp/aws" + version = ">= 3.61.0" + } + } +} \ No newline at end of file