{"id":13505652,"url":"https://github.com/nozaq/terraform-aws-lambda-auto-package","last_synced_at":"2025-10-07T11:53:32.172Z","repository":{"id":43125047,"uuid":"200487046","full_name":"nozaq/terraform-aws-lambda-auto-package","owner":"nozaq","description":"A terraform module to define a lambda function which source files are automatically built and packaged for lambda deployment.","archived":false,"fork":false,"pushed_at":"2023-01-14T07:08:47.000Z","size":56,"stargazers_count":27,"open_issues_count":2,"forks_count":22,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-07T01:04:45.876Z","etag":null,"topics":["aws","devops","lambda","terraform","terraform-modules"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nozaq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-04T11:58:47.000Z","updated_at":"2023-11-19T03:55:58.000Z","dependencies_parsed_at":"2023-02-09T19:00:35.570Z","dependency_job_id":null,"html_url":"https://github.com/nozaq/terraform-aws-lambda-auto-package","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/nozaq/terraform-aws-lambda-auto-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nozaq%2Fterraform-aws-lambda-auto-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nozaq%2Fterraform-aws-lambda-auto-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nozaq%2Fterraform-aws-lambda-auto-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nozaq%2Fterraform-aws-lambda-auto-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nozaq","download_url":"https://codeload.github.com/nozaq/terraform-aws-lambda-auto-package/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nozaq%2Fterraform-aws-lambda-auto-package/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262056207,"owners_count":23251626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","devops","lambda","terraform","terraform-modules"],"created_at":"2024-08-01T00:01:11.126Z","updated_at":"2025-10-07T11:53:27.118Z","avatar_url":"https://github.com/nozaq.png","language":"HCL","funding_links":[],"categories":["Community Modules"],"sub_categories":["Miscellaneous"],"readme":"# terraform-aws-lambda-auto-package\n\n[![Github Actions](https://github.com/nozaq/terraform-aws-lambda-auto-package/actions/workflows/main.yml/badge.svg)](https://github.com/nozaq/terraform-aws-lambda-auto-package/actions/workflows/main.yml)\n[![Releases](https://img.shields.io/github/v/release/nozaq/terraform-aws-lambda-auto-package)](https://github.com/nozaq/terraform-aws-lambda-auto-package/releases/tag/latest)\n\n[Terraform Module Registry](https://registry.terraform.io/modules/nozaq/lambda-auto-package/aws)\n\nA terraform module to define a lambda function which source files are automatically built and packaged for lambda deployment.\n\n## Features\n\nCreate a lambda function with the following supports.\n\n- Automatically archive the specified source directory into one zip file for Lambda deployment.\n- Invoke a build command before making an archive if specified. This allows installing additional dependencies, for example from requirements.txt, package.json etc.\n- Create an IAM role to publish lambda execution logs to CloudWatch Logs.\n\n## Usage\n\n```hcl\nmodule \"lambda\" {\n  source  = \"nozaq/lambda-auto-package/aws\"\n\n  source_dir  = \"${path.module}/source\"\n  output_path = \"${path.module}/source.zip\"\n\n  build_triggers = {\n    requirements = \"${base64sha256(file(\"${path.module}/source/requirements.txt\"))}\"\n    execute      = \"${base64sha256(file(\"${path.module}/pip.sh\"))}\"\n  }\n  build_command = \"${path.module}/pip.sh ${path.module}/source\"\n\n  iam_role_name_prefix = \"example-lambda-role\"\n\n  function_name = \"example-lambda\"\n  handler       = \"main.handler\"\n  runtime       = \"python3.7\"\n\n  environment = {\n    variables = {\n      EXAMPLE_VAR = \"foobar\"\n    }\n  }\n}\n```\n\nCheck [examples](./examples) for non-python examples.\n\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](#requirement\\_terraform) | \u003e= 0.15.0 |\n| \u003ca name=\"requirement_archive\"\u003e\u003c/a\u003e [archive](#requirement\\_archive) | \u003e= 2.2.0 |\n| \u003ca name=\"requirement_aws\"\u003e\u003c/a\u003e [aws](#requirement\\_aws) | \u003e= 3.50.0 |\n| \u003ca name=\"requirement_null\"\u003e\u003c/a\u003e [null](#requirement\\_null) | \u003e= 3.1.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_archive\"\u003e\u003c/a\u003e [archive](#provider\\_archive) | \u003e= 2.2.0 |\n| \u003ca name=\"provider_aws\"\u003e\u003c/a\u003e [aws](#provider\\_aws) | \u003e= 3.50.0 |\n| \u003ca name=\"provider_null\"\u003e\u003c/a\u003e [null](#provider\\_null) | \u003e= 3.1.0 |\n\n## Inputs\n\n| Name | Description | Type | Required |\n|------|-------------|------|:--------:|\n| \u003ca name=\"input_function_name\"\u003e\u003c/a\u003e [function\\_name](#input\\_function\\_name) | A unique name for your Lambda Function. | `string` | yes |\n| \u003ca name=\"input_handler\"\u003e\u003c/a\u003e [handler](#input\\_handler) | The function entrypoint in your code. | `string` | yes |\n| \u003ca name=\"input_output_path\"\u003e\u003c/a\u003e [output\\_path](#input\\_output\\_path) | A path to which the source directory is archived before uploading to AWS. | `string` | yes |\n| \u003ca name=\"input_runtime\"\u003e\u003c/a\u003e [runtime](#input\\_runtime) | The identifier of the function's runtime. | `string` | yes |\n| \u003ca name=\"input_source_dir\"\u003e\u003c/a\u003e [source\\_dir](#input\\_source\\_dir) | A path to the directory which contains source files. | `string` | yes |\n| \u003ca name=\"input_allowed_services\"\u003e\u003c/a\u003e [allowed\\_services](#input\\_allowed\\_services) | A list of AWS Services that are allowed to access this lambda. | `list(string)` | no |\n| \u003ca name=\"input_build_command\"\u003e\u003c/a\u003e [build\\_command](#input\\_build\\_command) | This is the build command to execute. It can be provided as a relative path to the current working directory or as an absolute path. It is evaluated in a shell, and can use environment variables or Terraform variables. | `string` | no |\n| \u003ca name=\"input_build_triggers\"\u003e\u003c/a\u003e [build\\_triggers](#input\\_build\\_triggers) | A map of values which should cause the build command to re-run. Values are meant to be interpolated references to variables or attributes of other resources. | `map(string)` | no |\n| \u003ca name=\"input_dead_letter_config\"\u003e\u003c/a\u003e [dead\\_letter\\_config](#input\\_dead\\_letter\\_config) | Nested block to configure the function's dead letter queue. | \u003cpre\u003eobject({\u003cbr\u003e    target_arn = string\u003cbr\u003e  })\u003c/pre\u003e | no |\n| \u003ca name=\"input_description\"\u003e\u003c/a\u003e [description](#input\\_description) | Description of what your Lambda Function does. | `string` | no |\n| \u003ca name=\"input_environment\"\u003e\u003c/a\u003e [environment](#input\\_environment) | A map that defines environment variables for the Lambda function. | \u003cpre\u003eobject({\u003cbr\u003e    variables = map(string)\u003cbr\u003e  })\u003c/pre\u003e | no |\n| \u003ca name=\"input_exclude_files\"\u003e\u003c/a\u003e [exclude\\_files](#input\\_exclude\\_files) | A list of directories or folders to ignore, e.g.\u003cbr\u003eexclude\\_files = [\"test\", \"src/**/*.ts\"] | `list(string)` | no |\n| \u003ca name=\"input_iam_role_name_prefix\"\u003e\u003c/a\u003e [iam\\_role\\_name\\_prefix](#input\\_iam\\_role\\_name\\_prefix) | The prefix string for the name of IAM role for the lambda function. | `string` | no |\n| \u003ca name=\"input_kms_key_id\"\u003e\u003c/a\u003e [kms\\_key\\_id](#input\\_kms\\_key\\_id) | The ARN of the KMS Key to use when encrypting log data. | `string` | no |\n| \u003ca name=\"input_lambda_kms_key_arn\"\u003e\u003c/a\u003e [lambda\\_kms\\_key\\_arn](#input\\_lambda\\_kms\\_key\\_arn) | The ARN of the KMS Key to use when encrypting environment variables. Ignored unless `environment` is specified. | `string` | no |\n| \u003ca name=\"input_layers\"\u003e\u003c/a\u003e [layers](#input\\_layers) | List of Lambda Layer Version ARNs (maximum of 5) to attach to your Lambda Function. | `list(string)` | no |\n| \u003ca name=\"input_memory_size\"\u003e\u003c/a\u003e [memory\\_size](#input\\_memory\\_size) | Amount of memory in MB your Lambda Function can use at runtime. | `number` | no |\n| \u003ca name=\"input_permissions_boundary\"\u003e\u003c/a\u003e [permissions\\_boundary](#input\\_permissions\\_boundary) | ARN of the policy that is used to set the permissions boundary for the role. | `string` | no |\n| \u003ca name=\"input_policy_arns\"\u003e\u003c/a\u003e [policy\\_arns](#input\\_policy\\_arns) | A list of IAM policy ARNs attached to the lambda function. | `list(string)` | no |\n| \u003ca name=\"input_publish\"\u003e\u003c/a\u003e [publish](#input\\_publish) | Whether to publish creation/change as new Lambda Function Version. | `bool` | no |\n| \u003ca name=\"input_reserved_concurrent_executions\"\u003e\u003c/a\u003e [reserved\\_concurrent\\_executions](#input\\_reserved\\_concurrent\\_executions) | The amount of reserved concurrent executions for this lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. | `number` | no |\n| \u003ca name=\"input_retention_in_days\"\u003e\u003c/a\u003e [retention\\_in\\_days](#input\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group. | `number` | no |\n| \u003ca name=\"input_tags\"\u003e\u003c/a\u003e [tags](#input\\_tags) | A mapping of tags to assign to resources. | `map(string)` | no |\n| \u003ca name=\"input_timeout\"\u003e\u003c/a\u003e [timeout](#input\\_timeout) | The maximum number of seconds the lambda function to run until timeout. | `number` | no |\n| \u003ca name=\"input_tracing_config\"\u003e\u003c/a\u003e [tracing\\_config](#input\\_tracing\\_config) | Can be either PassThrough or Active. If PassThrough, Lambda will only trace the request from an upstream service if it contains a tracing header with \"sampled=1\". If Active, Lambda will respect any tracing header it receives from an upstream service. If no tracing header is received, Lambda will call X-Ray for a tracing decision. | \u003cpre\u003eobject({\u003cbr\u003e    mode = string\u003cbr\u003e  })\u003c/pre\u003e | no |\n| \u003ca name=\"input_vpc_config\"\u003e\u003c/a\u003e [vpc\\_config](#input\\_vpc\\_config) | Provide this to allow your function to access your VPC. | \u003cpre\u003eobject({\u003cbr\u003e    security_group_ids = list(string)\u003cbr\u003e    subnet_ids         = list(string)\u003cbr\u003e  })\u003c/pre\u003e | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_iam_role\"\u003e\u003c/a\u003e [iam\\_role](#output\\_iam\\_role) | The IAM Role which the lambda function is attached. |\n| \u003ca name=\"output_lambda_function\"\u003e\u003c/a\u003e [lambda\\_function](#output\\_lambda\\_function) | The lambda function. |\n\u003c!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnozaq%2Fterraform-aws-lambda-auto-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnozaq%2Fterraform-aws-lambda-auto-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnozaq%2Fterraform-aws-lambda-auto-package/lists"}