{"id":21725273,"url":"https://github.com/jameswoolfenden/terraform-aws-lex-lambda","last_synced_at":"2025-04-12T22:52:56.475Z","repository":{"id":56526267,"uuid":"170933207","full_name":"JamesWoolfenden/terraform-aws-lex-lambda","owner":"JamesWoolfenden","description":"When working with lex and lambdas, we had a lot of resources associated to supporting one lambda, this just uses some sensible defaults to lighten the load.","archived":false,"fork":false,"pushed_at":"2024-09-07T09:21:21.000Z","size":171,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-07T10:41:17.970Z","etag":null,"topics":["aws","cloudwatch","lambda","lex","metrics","module","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamesWoolfenden.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2019-02-15T21:54:17.000Z","updated_at":"2024-09-07T09:21:25.000Z","dependencies_parsed_at":"2023-01-18T16:15:52.345Z","dependency_job_id":null,"html_url":"https://github.com/JamesWoolfenden/terraform-aws-lex-lambda","commit_stats":null,"previous_names":[],"tags_count":93,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesWoolfenden%2Fterraform-aws-lex-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesWoolfenden%2Fterraform-aws-lex-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesWoolfenden%2Fterraform-aws-lex-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesWoolfenden%2Fterraform-aws-lex-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamesWoolfenden","download_url":"https://codeload.github.com/JamesWoolfenden/terraform-aws-lex-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226433161,"owners_count":17624209,"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","cloudwatch","lambda","lex","metrics","module","terraform"],"created_at":"2024-11-26T03:16:57.241Z","updated_at":"2024-11-26T03:16:58.143Z","avatar_url":"https://github.com/JamesWoolfenden.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terraform-aws-lex-lambda\n\nterraform-aws-lex-lambda\n\n[![Build Status](https://github.com/JamesWoolfenden/terraform-aws-lex-lambda/workflows/Verify%20and%20Bump/badge.svg?branch=master)](https://github.com/JamesWoolfenden/terraform-aws-lex-lambda)\n[![Latest Release](https://img.shields.io/github/release/JamesWoolfenden/terraform-aws-lex-lambda.svg)](https://github.com/JamesWoolfenden/terraform-aws-lex-lambda/releases/latest)\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/JamesWoolfenden/terraform-aws-lex-lambda.svg?label=latest)](https://github.com/JamesWoolfenden/terraform-aws-lex-lambda/releases/latest)\n![Terraform Version](https://img.shields.io/badge/tf-%3E%3D0.14.0-blue.svg)\n[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/JamesWoolfenden/terraform-aws-lex-lambda/cis_aws)](https://www.bridgecrew.cloud/link/badge?vcs=github\u0026fullRepo=JamesWoolfenden%2Fterraform-aws-lex-lambda\u0026benchmark=CIS+AWS+V1.2)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![checkov](https://img.shields.io/badge/checkov-verified-brightgreen)](https://www.checkov.io/)\n[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/jameswoolfenden/terraform-aws-lex-lambda/general)](https://www.bridgecrew.cloud/link/badge?vcs=github\u0026fullRepo=JamesWoolfenden%2Fterraform-aws-lex-lambda\u0026benchmark=INFRASTRUCTURE+SECURITY)\n\nThe terraform module creates lambda with permissions, for my purposes a lex lambda combination bit options for IAM and CLoudwatch.\nTo use a lambda with an intent a number of other objects are either required. In this module I have included a number of reasonable default values.\nThis should make it easier to build the lambdas that go with your lex objects.\nThe Lamda permission is a array/list this means you can add as many permissions to lambda as you need to.\n\nHow to use this project:\n\n---\n\nIt's 100% Open Source and licensed under the [APACHE2](LICENSE).\n\n## Usage\n\nThis is a minimal example **Examplea**, but with Cloudwatch alarms enabled.\n\n```terraform\nmodule lexlambda {\n  source = \"github.com/jameswoolfenden/terraform-aws-lex-lambda\"\n  version= \"0.3.40\"\n\n  lambdapermmissions = [{\n    intent     = \"Pizza\"\n    source_arn = \"Pizza:*\"\n  }]\n\n  account_id     = data.aws_caller_identity.current.account_id\n  alarms_enabled = true\n  common_tags    = var.common_tags\n  description    = \"Best Pizza!!\"\n  filename       = \"${path.module}/lambda.zip\"\n  name           = var.name\n  region_name    = data.aws_region.current.name\n  role_arn       = data.aws_iam_role.lambda.arn\n}\n```\n\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n## Requirements\n\nNo requirements.\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_aws\"\u003e\u003c/a\u003e [aws](#provider\\_aws) | n/a |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [aws_cloudwatch_log_group.lambda](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |\n| [aws_cloudwatch_metric_alarm.invocations](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource |\n| [aws_lambda_function.withintent](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |\n| [aws_lambda_permission.withintent](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |\n| [aws_sns_topic.lambda](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic) | resource |\n| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n| [aws_iam_policy_document.sns](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_account_id\"\u003e\u003c/a\u003e [account\\_id](#input\\_account\\_id) | The Aws account the policy or object should target | `string` | n/a | yes |\n| \u003ca name=\"input_action\"\u003e\u003c/a\u003e [action](#input\\_action) | Action for the Lambda permission | `string` | `\"lambda:InvokeFunction\"` | no |\n| \u003ca name=\"input_alarms_enabled\"\u003e\u003c/a\u003e [alarms\\_enabled](#input\\_alarms\\_enabled) | Cloudwatch alarms enabled | `bool` | `false` | no |\n| \u003ca name=\"input_common_tags\"\u003e\u003c/a\u003e [common\\_tags](#input\\_common\\_tags) | Implements the common tags scheme | `map(any)` | n/a | yes |\n| \u003ca name=\"input_description\"\u003e\u003c/a\u003e [description](#input\\_description) | Of the the Lambda | `string` | n/a | yes |\n| \u003ca name=\"input_envvar\"\u003e\u003c/a\u003e [envvar](#input\\_envvar) | Optional set of environmental variables for the lambda | `map(any)` | \u003cpre\u003e{\u003cbr\u003e  \"Terraform\": \"Bug\"\u003cbr\u003e}\u003c/pre\u003e | no |\n| \u003ca name=\"input_filename\"\u003e\u003c/a\u003e [filename](#input\\_filename) | name of zip file if any | `string` | `null` | no |\n| \u003ca name=\"input_handler\"\u003e\u003c/a\u003e [handler](#input\\_handler) | The file the lambda should import | `string` | `\"index.handler\"` | no |\n| \u003ca name=\"input_kms_key_id\"\u003e\u003c/a\u003e [kms\\_key\\_id](#input\\_kms\\_key\\_id) | ARN of CMK for Lambda,SNS | `string` | n/a | yes |\n| \u003ca name=\"input_kms_master_key_id\"\u003e\u003c/a\u003e [kms\\_master\\_key\\_id](#input\\_kms\\_master\\_key\\_id) | ID of CMK for Lambda,SNS | `string` | n/a | yes |\n| \u003ca name=\"input_lambdapermmissions\"\u003e\u003c/a\u003e [lambdapermmissions](#input\\_lambdapermmissions) | This takes a list object with values to set permissions of a lambda. Can take multiple permission objects | `list(any)` | `[]` | no |\n| \u003ca name=\"input_layers\"\u003e\u003c/a\u003e [layers](#input\\_layers) | Optionally, add in up 5 lambda layers | `list(any)` | `[]` | no |\n| \u003ca name=\"input_memory_size\"\u003e\u003c/a\u003e [memory\\_size](#input\\_memory\\_size) | Of the the lambda | `string` | `\"128\"` | no |\n| \u003ca name=\"input_metric_comparison_operator\"\u003e\u003c/a\u003e [metric\\_comparison\\_operator](#input\\_metric\\_comparison\\_operator) | For Cloudwatch Alarms | `string` | `\"GreaterThanThreshold\"` | no |\n| \u003ca name=\"input_metric_datapoints_to_alarm\"\u003e\u003c/a\u003e [metric\\_datapoints\\_to\\_alarm](#input\\_metric\\_datapoints\\_to\\_alarm) | For Cloudwatch Alarms | `number` | `1` | no |\n| \u003ca name=\"input_metric_evaluation_periods\"\u003e\u003c/a\u003e [metric\\_evaluation\\_periods](#input\\_metric\\_evaluation\\_periods) | For Cloudwatch Alarms | `number` | `1` | no |\n| \u003ca name=\"input_metric_metric_name\"\u003e\u003c/a\u003e [metric\\_metric\\_name](#input\\_metric\\_metric\\_name) | n/a | `string` | `\"Invocations\"` | no |\n| \u003ca name=\"input_metric_period\"\u003e\u003c/a\u003e [metric\\_period](#input\\_metric\\_period) | n/a | `number` | `300` | no |\n| \u003ca name=\"input_metric_statistic\"\u003e\u003c/a\u003e [metric\\_statistic](#input\\_metric\\_statistic) | n/a | `string` | `\"Average\"` | no |\n| \u003ca name=\"input_metric_threshold\"\u003e\u003c/a\u003e [metric\\_threshold](#input\\_metric\\_threshold) | n/a | `number` | `100` | no |\n| \u003ca name=\"input_name\"\u003e\u003c/a\u003e [name](#input\\_name) | Name of Lambda object | `string` | n/a | yes |\n| \u003ca name=\"input_prefixdash\"\u003e\u003c/a\u003e [prefixdash](#input\\_prefixdash) | Support for renaming on multi-environments | `string` | `\"\"` | no |\n| \u003ca name=\"input_principal\"\u003e\u003c/a\u003e [principal](#input\\_principal) | n/a | `string` | `\"lex.amazonaws.com\"` | no |\n| \u003ca name=\"input_region_name\"\u003e\u003c/a\u003e [region\\_name](#input\\_region\\_name) | Aws region name, eu-west-1... | `string` | n/a | yes |\n| \u003ca name=\"input_role_arn\"\u003e\u003c/a\u003e [role\\_arn](#input\\_role\\_arn) | The name you want your IAM role to have | `string` | n/a | yes |\n| \u003ca name=\"input_runtime\"\u003e\u003c/a\u003e [runtime](#input\\_runtime) | Language the code runs in | `string` | `\"nodejs8.10\"` | no |\n| \u003ca name=\"input_s3_bucket\"\u003e\u003c/a\u003e [s3\\_bucket](#input\\_s3\\_bucket) | path to the lambda bucket | `string` | `null` | no |\n| \u003ca name=\"input_s3_key\"\u003e\u003c/a\u003e [s3\\_key](#input\\_s3\\_key) | path to the lambda zip | `string` | `null` | no |\n| \u003ca name=\"input_security_group_ids\"\u003e\u003c/a\u003e [security\\_group\\_ids](#input\\_security\\_group\\_ids) | The IDs of some security groups | `list(string)` | `[]` | no |\n| \u003ca name=\"input_subnet_ids\"\u003e\u003c/a\u003e [subnet\\_ids](#input\\_subnet\\_ids) | Subnet IDs... | `list(string)` | `[]` | no |\n| \u003ca name=\"input_timeout\"\u003e\u003c/a\u003e [timeout](#input\\_timeout) | Of the the lambda | `string` | `\"100\"` | no |\n| \u003ca name=\"input_tracing_config\"\u003e\u003c/a\u003e [tracing\\_config](#input\\_tracing\\_config) | Sets the x-ray tracing mode | `string` | `\"Active\"` | no |\n| \u003ca name=\"input_vpc_config\"\u003e\u003c/a\u003e [vpc\\_config](#input\\_vpc\\_config) | Optional Vpc attachment config | `map(any)` | `{}` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_lambda\"\u003e\u003c/a\u003e [lambda](#output\\_lambda) | n/a |\n| \u003ca name=\"output_lambda_arn\"\u003e\u003c/a\u003e [lambda\\_arn](#output\\_lambda\\_arn) | n/a |\n| \u003ca name=\"output_memory_size\"\u003e\u003c/a\u003e [memory\\_size](#output\\_memory\\_size) | n/a |\n| \u003ca name=\"output_source_code_size\"\u003e\u003c/a\u003e [source\\_code\\_size](#output\\_source\\_code\\_size) | n/a |\n| \u003ca name=\"output_timeout\"\u003e\u003c/a\u003e [timeout](#output\\_timeout) | n/a |\n\u003c!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n\n## Policy\n\nThis is the policy required to build this project:\n\n\u003c!-- BEGINNING OF PRE-COMMIT-PIKE DOCS HOOK --\u003e\nThe Terraform resource required is:\n\n```golang\nresource \"aws_iam_policy\" \"terraform_pike\" {\n  name_prefix = \"terraform_pike\"\n  path        = \"/\"\n  description = \"Pike Autogenerated policy from IAC\"\n\n  policy = jsonencode({\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"VisualEditor0\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"SNS:CreateTopic\",\n                \"SNS:DeleteTopic\",\n                \"SNS:GetTopicAttributes\",\n                \"SNS:ListTagsForResource\",\n                \"SNS:SetTopicAttributes\",\n                \"SNS:TagResource\",\n                \"SNS:UnTagResource\"\n            ],\n            \"Resource\": \"*\"\n        },\n        {\n            \"Sid\": \"VisualEditor1\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"cloudwatch:DeleteAlarms\",\n                \"cloudwatch:DescribeAlarms\",\n                \"cloudwatch:ListTagsForResource\",\n                \"cloudwatch:PutMetricAlarm\"\n            ],\n            \"Resource\": \"*\"\n        },\n        {\n            \"Sid\": \"VisualEditor2\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"ec2:DescribeAccountAttributes\"\n            ],\n            \"Resource\": \"*\"\n        },\n        {\n            \"Sid\": \"VisualEditor3\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"iam:PassRole\"\n            ],\n            \"Resource\": \"*\"\n        },\n        {\n            \"Sid\": \"VisualEditor4\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"lambda:AddPermission\",\n                \"lambda:CreateFunction\",\n                \"lambda:DeleteFunction\",\n                \"lambda:GetFunction\",\n                \"lambda:GetFunctionCodeSigningConfig\",\n                \"lambda:GetPolicy\",\n                \"lambda:ListVersionsByFunction\",\n                \"lambda:RemovePermission\",\n                \"lambda:TagResource\",\n                \"lambda:UntagResource\"\n            ],\n            \"Resource\": \"*\"\n        },\n        {\n            \"Sid\": \"VisualEditor5\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"logs:AssociateKmsKey\",\n                \"logs:CreateLogGroup\",\n                \"logs:DeleteLogGroup\",\n                \"logs:DeleteRetentionPolicy\",\n                \"logs:DescribeLogGroups\",\n                \"logs:DisassociateKmsKey\",\n                \"logs:ListTagsLogGroup\",\n                \"logs:PutRetentionPolicy\"\n            ],\n            \"Resource\": \"*\"\n        }\n    ]\n})\n}\n\n\n```\n\u003c!-- END OF PRE-COMMIT-PIKE DOCS HOOK --\u003e\n\n## Related Projects\n\nCheck out these related projects.\n\n- [terraform-aws-codecommit](https://github.com/jameswoolfenden/terraform-aws-codebuild) - Storing ones code\n\n## Help\n\n**Got a question?**\n\nFile a GitHub [issue](https://github.com/JamesWoolfenden/terraform-aws-lex-lambda/issues).\n\n## Contributing\n\n### Bug Reports \u0026 Feature Requests\n\nPlease use the [issue tracker](https://github.com/JamesWoolfenden/terraform-aws-lex-lambda/issues) to report any bugs or file feature requests.\n\n## Copyrights\n\nCopyright © 2019-2022 James Woolfenden\n\n## License\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nSee [LICENSE](LICENSE) for full details.\n\nLicensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements. See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership. The ASF licenses this file\nto you under the Apache License, Version 2.0 (the\n\"License\"); you may not use this file except in compliance\nwith the License. You may obtain a copy of the License at\n\n\u003chttps://www.apache.org/licenses/LICENSE-2.0\u003e\n\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an\n\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied. See the License for the\nspecific language governing permissions and limitations\nunder the License.\n\n### Contributors\n\n[![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]\u003cbr/\u003e[James Woolfenden][jameswoolfenden_homepage] |\n\n[jameswoolfenden_homepage]: https://github.com/jameswoolfenden\n[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameswoolfenden%2Fterraform-aws-lex-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjameswoolfenden%2Fterraform-aws-lex-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameswoolfenden%2Fterraform-aws-lex-lambda/lists"}