diff --git a/README.md b/README.md index f9911d9..2f3c988 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ Here are some examples of how you can use this module in your inventory structur names = [ "python_layer" ] - layer_filename = "./../../lambda/packages/Python3-lambda.zip" + layer_filenames = ["./../../lambda/packages/Python3-lambda.zip"] compatible_runtimes = [ ["python3.8"] ] @@ -172,7 +172,7 @@ Here are some examples of how you can use this module in your inventory structur | iam\_actions | The actions for Iam Role Policy. | list | `` | no | | kms\_key\_arn | The ARN for the KMS encryption key. | string | `""` | no | | label\_order | Label order, e.g. `name`,`application`. | list | `` | no | -| layer\_filename | The path to the function's deployment package within the local filesystem. If defined, The s3\_-prefixed options cannot be used. | string | `""` | no | +| layer\_filenames | The path to the function's deployment package within the local filesystem. If defined, The s3\_-prefixed options cannot be used. | list | `` | no | | layers | List of Lambda Layer Version ARNs \(maximum of 5\) to attach to your Lambda Function. | string | `""` | no | | license\_infos | License info for your Lambda Layer. See License Info. | list | `` | no | | managedby | ManagedBy, eg 'CloudDrove' or 'AnmolNagpal'. | string | `"anmol@clouddrove.com"` | no | diff --git a/README.yaml b/README.yaml index 96c546a..104bb9e 100644 --- a/README.yaml +++ b/README.yaml @@ -92,7 +92,7 @@ usage : |- names = [ "python_layer" ] - layer_filename = "./../../lambda/packages/Python3-lambda.zip" + layer_filenames = ["./../../lambda/packages/Python3-lambda.zip"] compatible_runtimes = [ ["python3.8"] ] diff --git a/_example/complete-function/example.tf b/_example/complete-function/example.tf index 133046d..29382a8 100644 --- a/_example/complete-function/example.tf +++ b/_example/complete-function/example.tf @@ -23,7 +23,7 @@ module "lambda" { names = [ "python_layer" ] - layer_filename = "./../../lambda/packages/Python3-lambda.zip" + layer_filenames = ["./../../lambda/packages/Python3-lambda.zip"] compatible_runtimes = [ ["python3.8"] ] diff --git a/main.tf b/main.tf index 98f6b29..a615b23 100644 --- a/main.tf +++ b/main.tf @@ -69,7 +69,7 @@ resource "aws_iam_role_policy_attachment" "default" { # Description : Terraform module to create Lambda layers resource on AWS. resource "aws_lambda_layer_version" "default" { count = length(var.names) > 0 && var.enabled ? length(var.names) : 0 - filename = length(var.layer_filename) > 0 ? var.layer_filename : null + filename = length(var.layer_filenames) > 0 ? element(var.layer_filenames, count.index) : null s3_bucket = length(var.s3_buckets) > 0 ? element(var.s3_buckets, count.index) : null s3_key = length(var.s3_keies) > 0 ? element(var.s3_keies, count.index) : null s3_object_version = length(var.s3_object_versions) > 0 ? element(var.s3_object_versions, count.index) : null @@ -77,7 +77,6 @@ resource "aws_lambda_layer_version" "default" { compatible_runtimes = element(var.compatible_runtimes, count.index) description = length(var.descriptions) > 0 ? element(var.descriptions, count.index) : "" license_info = length(var.license_infos) > 0 ? element(var.license_infos, count.index) : "" - source_code_hash = length(var.layer_filename) > 0 ? filesha256(var.layer_filename) : "" } # Module : Archive file diff --git a/variables.tf b/variables.tf index 2f7c83f..4d56676 100644 --- a/variables.tf +++ b/variables.tf @@ -127,9 +127,9 @@ variable "kms_key_arn" { description = "The ARN for the KMS encryption key." } -variable "layer_filename" { - type = string - default = "" +variable "layer_filenames" { + type = list + default = [] description = "The path to the function's deployment package within the local filesystem. If defined, The s3_-prefixed options cannot be used." }