{"id":15156354,"url":"https://github.com/spring-media/terraform-aws-lambda","last_synced_at":"2025-09-30T04:32:28.053Z","repository":{"id":32927066,"uuid":"145156578","full_name":"spring-media/terraform-aws-lambda","owner":"spring-media","description":"A Terraform module to create AWS Lambda ressources.","archived":true,"fork":false,"pushed_at":"2023-09-07T08:20:59.000Z","size":154,"stargazers_count":66,"open_issues_count":6,"forks_count":45,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-09-27T19:20:49.891Z","etag":null,"topics":["aws","aws-lambda","cloudwatch-events","dynamodb","kinesis","lambda","s3","serverless","sns","sqs","terraform","terraform-modules"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/spring-media/lambda/aws","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/spring-media.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-17T19:00:07.000Z","updated_at":"2024-08-15T01:21:12.000Z","dependencies_parsed_at":"2023-01-14T22:42:32.639Z","dependency_job_id":null,"html_url":"https://github.com/spring-media/terraform-aws-lambda","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-media%2Fterraform-aws-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-media%2Fterraform-aws-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-media%2Fterraform-aws-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-media%2Fterraform-aws-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spring-media","download_url":"https://codeload.github.com/spring-media/terraform-aws-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234702079,"owners_count":18873825,"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","aws-lambda","cloudwatch-events","dynamodb","kinesis","lambda","s3","serverless","sns","sqs","terraform","terraform-modules"],"created_at":"2024-09-26T19:20:25.723Z","updated_at":"2025-09-30T04:32:22.784Z","avatar_url":"https://github.com/spring-media.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS Lambda Terraform module\n\n![](https://github.com/spring-media/terraform-aws-lambda/workflows/Terraform%20CI/badge.svg) [![Terraform Module Registry](https://img.shields.io/badge/Terraform%20Module%20Registry-5.2.1-blue.svg)](https://registry.terraform.io/modules/spring-media/lambda/aws/5.2.1) ![Terraform Version](https://img.shields.io/badge/Terraform-0.12+-green.svg) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n---\n\n# Deprecation warning\n\nFurther development of this module will be continued in [moritzzimmer/terraform-aws-lambda](https://github.com/moritzzimmer/terraform-aws-lambda). Users of `spring-media/lambda/aws` \nshould migrate to this module as a drop-in replacement for all provisions up to release/tag `5.2.1` to benefit from new features and bugfixes.\n\n```hcl-terraform\nmodule \"lambda\" {\n  source           = \"moritzzimmer/lambda/aws\"\n  version          = \"5.2.1\"\n  filename         = \"my-package.zip\"\n  function_name    = \"my-function\"\n  handler          = \"my-handler\"\n  runtime          = \"go1.x\"\n  source_code_hash = filebase64sha256(\"${path.module}/my-package.zip\")\n}\n``` \n\n---\n\n\nTerraform module to create AWS [Lambda](https://www.terraform.io/docs/providers/aws/r/lambda_function.html) resources with configurable event sources, IAM configuration (following the [principal of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege)), VPC as well as SSM/KMS and log streaming support.\n\nThe following [event sources](https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html) are supported (see [examples](#examples)):\n\n- [cloudwatch-event](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-cloudwatch-event): configures a [CloudWatch Event Rule](https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_rule.html) to trigger the Lambda by CloudWatch [event pattern](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) or on a regular, scheduled basis\n- [dynamodb](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-dynamodb-event): configures an [Event Source Mapping](https://www.terraform.io/docs/providers/aws/r/lambda_event_source_mapping.html) to trigger the Lambda by DynamoDb events\n- [kinesis](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-kinesis-event): configures an [Event Source Mapping](https://www.terraform.io/docs/providers/aws/r/lambda_event_source_mapping.html) to trigger the Lambda by Kinesis events\n- [s3](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-s3-event): configures permission to trigger the Lambda by S3\n- [sns](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-sns-event): to trigger Lambda by [SNS Topic Subscription](https://www.terraform.io/docs/providers/aws/r/sns_topic_subscription.html)\n- [sqs](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-sqs-event): configures an [Event Source Mapping](https://www.terraform.io/docs/providers/aws/r/lambda_event_source_mapping.html) to trigger the Lambda by SQS events\n\nFurthermore this module supports:\n\n- reading configuration and secrets from [AWS Systems Manager Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html) including decryption of [SecureString](https://docs.aws.amazon.com/kms/latest/developerguide/services-parameter-store.html) parameters\n- [CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html) Log group configuration including retention time and [subscription filters](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html) e.g. to stream logs via Lambda to Elasticsearch\n\n## Terraform version compatibility\n\n| module | terraform |     branch      |\n| :----: | :-------: | :-------------: |\n| 4.x.x  |  0.12+   |     master      |\n| 3.x.x  |  0.11.x   | terraform_0.11x |\n\n## How do I use this module?\n\nThe module can be used for all [runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) supported by AWS Lambda. \n\nDeployment packages can be specified either directly as a local file (using the `filename` argument) or indirectly via Amazon S3 (using the `s3_bucket`, `s3_key` and `s3_object_versions` arguments), see [documentation](https://www.terraform.io/docs/providers/aws/r/lambda_function.html#specifying-the-deployment-package) for details.\n\n**basic**\n\n```terraform\nprovider \"aws\" {\n  region = \"eu-west-1\"\n}\n\nmodule \"lambda\" {\n  source           = \"spring-media/lambda/aws\"\n  version          = \"5.2.1\"\n  filename         = \"my-package.zip\"\n  function_name    = \"my-function\"\n  handler          = \"my-handler\"\n  runtime          = \"go1.x\"\n  source_code_hash = filebase64sha256(\"${path.module}/my-package.zip\")\n}\n```\n\n**with event trigger**\n\n```terraform\nmodule \"lambda\" {\n  // see above\n  \n  event = {\n    type                = \"cloudwatch-event\"\n    schedule_expression = \"rate(1 minute)\"\n  }\n}\n```\n\n**in a VPC**\n\n```terraform\nmodule \"lambda\" {\n  // see above\n\n  vpc_config = {\n    security_group_ids = [\"sg-1\"]\n    subnet_ids         = [\"subnet-1\", \"subnet-2\"]\n  }\n}\n```\n\n**with access to parameter store**\n\n```terraform\nmodule \"lambda\" {\n  // see above\n\n  ssm_parameter_names = [\"some/config/root/*\"]\n  kms_key_arn         = \"arn:aws:kms:eu-west-1:647379381847:key/f79f2b-04684-4ad9-f9de8a-79d72f\"\n}\n```\n\n**with log subscription (stream to ElasticSearch)**\n\n```terraform\nmodule \"lambda\" {\n  // see above\n\n  logfilter_destination_arn = \"arn:aws:lambda:eu-west-1:647379381847:function:cloudwatch_logs_to_es_production\"\n}\n```\n\n### Examples\n\n- [example-with-cloudwatch-event](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-cloudwatch-event)\n- [example-with-dynamodb-event](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-dynamodb-event)\n- [example-with-kinesis-event](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-kinesis-event)\n- [example-with-s3-event](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-s3-event)\n- [example-with-sns-event](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-sns-event)\n- [example-with-sqs-event](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-sqs-event)\n- [example-with-vpc](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-with-vpc)\n- [example-without-event](https://github.com/spring-media/terraform-aws-lambda/tree/master/examples/example-without-event)\n\n## How do I contribute to this module?\n\nContributions are very welcome! Check out the [Contribution Guidelines](https://github.com/spring-media/terraform-aws-lambda/blob/master/CONTRIBUTING.md) for instructions.\n\n## How is this module versioned?\n\nThis Module follows the principles of [Semantic Versioning](http://semver.org/). You can find each new release in the [releases page](../../releases).\n\nDuring initial development, the major version will be 0 (e.g., `0.x.y`), which indicates the code does not yet have a\nstable API. Once we hit `1.0.0`, we will make every effort to maintain a backwards compatible API and use the MAJOR,\nMINOR, and PATCH versions on each release to indicate any incompatibilities.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspring-media%2Fterraform-aws-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspring-media%2Fterraform-aws-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspring-media%2Fterraform-aws-lambda/lists"}