https://github.com/tomarv2/terraform-aws-lambda
Terraform module to deploy AWS Lambda.
https://github.com/tomarv2/terraform-aws-lambda
aws aws-lambda checkov lambda terraform terraform-modules terratest
Last synced: over 1 year ago
JSON representation
Terraform module to deploy AWS Lambda.
- Host: GitHub
- URL: https://github.com/tomarv2/terraform-aws-lambda
- Owner: tomarv2
- License: apache-2.0
- Created: 2021-02-13T17:26:21.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-04-04T04:59:32.000Z (over 3 years ago)
- Last Synced: 2025-03-22T15:49:52.190Z (over 1 year ago)
- Topics: aws, aws-lambda, checkov, lambda, terraform, terraform-modules, terratest
- Language: HCL
- Homepage: https://terraform-aws-lambda.vercel.app
- Size: 229 KB
- Stars: 2
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Terraform module for [AWS Lambda](https://registry.terraform.io/modules/tomarv2/lambda/aws/latest)
### Versions
- Module tested for Terraform 1.0.1.
- AWS provider version [4.35](https://registry.terraform.io/providers/hashicorp/aws/latest).
- `main` branch: Provider versions not pinned to keep up with Terraform releases.
- `tags` releases: Tags are pinned with versions (use
).
### Usage
#### Option 1:
```
terrafrom init
terraform plan -var='teamid=tryme' -var='prjid=project1'
terraform apply -var='teamid=tryme' -var='prjid=project1'
terraform destroy -var='teamid=tryme' -var='prjid=project1'
```
**Note:** With this option please take care of remote state storage
#### Option 2:
##### Recommended method (stores remote state in remote backend(S3, Azure storage, or Google bucket) using `prjid` and `teamid` to create directory structure):
- Create python 3.8+ virtual environment
```
python3 -m venv
```
- Install package:
```
pip install tfremote --upgrade
```
- Set below environment variables:
```
export TF_AWS_BUCKET=
export TF_AWS_BUCKET_REGION=us-west-2
export TF_AWS_PROFILE=
```
or
- Set below environment variables:
```
export TF_AWS_BUCKET=
export TF_AWS_BUCKET_REGION=us-west-2
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
```
- Updated `examples` directory with required values.
- Run and verify the output before deploying:
```
tf -c=aws plan -var='teamid=foo' -var='prjid=bar'
```
- Run below to deploy:
```
tf -c=aws apply -var='teamid=foo' -var='prjid=bar'
```
- Run below to destroy:
```
tf -c=aws destroy -var='teamid=foo' -var='prjid=bar'
```
**Note:** Read more on [tfremote](https://github.com/tomarv2/tfremote)
Please refer to examples directory [link](examples) for references.
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0.1 |
| [archive](#requirement\_archive) | >= 2.1 |
| [aws](#requirement\_aws) | ~> 4.35 |
| [external](#requirement\_external) | >= 2.1.0 |
| [null](#requirement\_null) | >= 3.1.0 |
## Providers
| Name | Version |
|------|---------|
| [archive](#provider\_archive) | >= 2.1 |
| [aws](#provider\_aws) | ~> 4.35 |
| [external](#provider\_external) | >= 2.1.0 |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_lambda_function.lambda](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
| [archive_file.zip](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
| [external_external.install_python_dependencies](https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/external) | data source |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [config](#input\_config) | Lambda configuration | `map(any)` | `{}` | no |
| [extra\_tags](#input\_extra\_tags) | Additional tags to associate | `map(string)` | `{}` | no |
## Outputs
| Name | Description |
|------|-------------|
| [arn](#output\_arn) | ARN of the Lambda function |
| [function\_name](#output\_function\_name) | Name of the Lambda function |
| [output\_path](#output\_output\_path) | Output file path location |
| [output\_size](#output\_output\_size) | Output file size |
| [source\_dir](#output\_source\_dir) | Source code location |
| [source\_file](#output\_source\_file) | Lambda source code location |