{"id":19854653,"url":"https://github.com/obytes/terraform-aws-codeless-lambda","last_synced_at":"2026-03-04T19:31:48.795Z","repository":{"id":77139355,"uuid":"411191945","full_name":"obytes/terraform-aws-codeless-lambda","owner":"obytes","description":"Terraform and AWS Lambda External CI","archived":false,"fork":false,"pushed_at":"2021-11-04T14:07:59.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-02-28T23:37:15.722Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/obytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-28T08:08:34.000Z","updated_at":"2021-11-04T14:08:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"acd3784a-5a74-4d06-b2cb-6882a27cface","html_url":"https://github.com/obytes/terraform-aws-codeless-lambda","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/obytes/terraform-aws-codeless-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-codeless-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-codeless-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-codeless-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-codeless-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obytes","download_url":"https://codeload.github.com/obytes/terraform-aws-codeless-lambda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-codeless-lambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30090525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T18:31:08.343Z","status":"ssl_error","status_checked_at":"2026-03-04T18:31:07.708Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-12T14:10:03.100Z","updated_at":"2026-03-04T19:31:48.776Z","avatar_url":"https://github.com/obytes.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform aws codeless lambda\n\nDecoupling AWS Lambda code/dependencies continuous integration/deployment from Terraform to external CI service like \ncodebuild/codepipeline, github actions or circle CI...\n\n## Concept\n\nThis module achieves that by providing a dummy code package to Terraform Lambda resource and instructing terraform to \nignore any changes affecting `s3_key`, `s3_bucket`, `layers` and `filename` attributes. as they will be changed by an \nexternal CI service. and we don’t want Terraform to revert those changes on every deploy.\n\nSince the lambda version will be changed constantly, the module also creates an alias with the name `latest` and on each \ndeploy the external CI service can update the alias with the new deployed lambda version.\n\nThe main advantage of Lambda alias is to avoid other resources depending on the lambda function from invoking a broken \nlambda function version, and they will always invoke the latest stable version that the CI process have tagged with \n`latest` alias at the end of the pipeline.\n\nThe other advantage is the ability for other services to invoke `latest` version without needing to update those \nservices whenever the function version changes.\n\n\u003e A lambda alias is required in case you want to implement provisioned concurrency afterwards.\n\n## Usage\n\n### Creating Lambda\n\n```hcl\nmodule \"lambda\" {\n  source      = \"git::https://github.com/obytes/terraform-aws-codeless-lambda.git//modules/lambda\"\n  prefix      = \"demo-api\"\n  common_tags = {env = \"test\", stack = \"demos\"}\n  description = \"Terraform is my creator but Codepipeline is the demon I listen to\"\n  \n  envs        = {API_KEY = \"not-secret\"}\n  runtime     = \"python3.9\"\n  handler     = \"app.handler\"\n  timeout     = 29\n  memory_size = 1024\n  \n  policy_json            = data.aws_iam_policy_document.policy.json\n  logs_retention_in_days = 14\n}\n```\n\n### Hook it to CI pipeline\n\n- Manual CI using [aws-lambda-ci](https://github.com/obytes/aws-lambda-ci):\n\nIn case you are still developing your function locally and you want to start a manual CI you can use `aws-lambda-ci`.\n\n```bash\npip3 install aws-lambda-ci\naws-lambda-ci \\\n--app-s3-bucket \"demo-artifacts\" \\\n--function-name \"demo-api\" \\\n--function-runtime \"python3.9\" \\\n--function-alias-name \"latest\" \\\n--function-layer-name \"demo-api-deps\" \\\n--app-src-path \"src\" \\\n--app-packages-descriptor-path \"requirements.txt\" \\\n--source-version \"1.0.2\" \\\n--aws-profile-name \"kodhive_prd\" \\\n--watch-log-stream\n```\n\n- Automated CI using [terraform-aws-lambda-ci](https://github.com/obytes/terraform-aws-lambda-ci)\n\nIn case your lambda function is already version controlled in Github, You can trigger CI Pipeline in response to Github\nwebhook events like `push` to a branch or a tag `release`.\n\n```hcl\nmodule \"lambda_ci\" {\n  source      = \"git::https://github.com/obytes/terraform-aws-lambda-ci.git//modules/ci\"\n  prefix      = \"demo-api-ci\"\n  common_tags = {env = \"test\", stack = \"demos-ci\"}\n\n  lambda                   = module.lambda.lambda\n  app_src_path             = \"src\"\n  packages_descriptor_path = \"requirements.txt\"\n\n  # Github\n  s3_artifacts = {\n    arn    = aws_s3_bucket.artifacts.arn\n    bucket = aws_s3_bucket.artifacts.bucket\n  }\n  pre_release  = true\n  github       = {\n    owner          = \"obytes\"\n    token          = \"gh_123456789876543234567845678\"\n    webhook_secret = \"not-secret\"\n    connection_arn = \"[GH_CODESTAR_CONNECTION_ARN]\"\n  }\n  github_repository = {\n    name   = \"demo-api\"\n    branch = \"main\"\n  }\n\n  # Notifications\n  ci_notifications_slack_channels = {\n    info  = \"ci-info\"\n    alert = \"ci-alert\"\n  }\n}\n```\n\n\u003e [terraform-aws-lambda-ci](https://github.com/obytes/terraform-aws-lambda-ci) is leveraging \n\u003e [aws-lambda-ci](https://github.com/obytes/aws-lambda-ci) in the background!\n\n\n### More info\n\nYou can read this [article](https://www.obytes.com/blog/go-serverless-part-2-terraform-and-aws-lambda-external-ci) for \nmore details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobytes%2Fterraform-aws-codeless-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobytes%2Fterraform-aws-codeless-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobytes%2Fterraform-aws-codeless-lambda/lists"}