|
| 1 | +# Terraform AWS ARC Lambda-Function Module Usage Guide |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +### Purpose of the Document |
| 6 | + |
| 7 | +This document provides guidelines and instructions for users looking to create lambda-function using the module. |
| 8 | + |
| 9 | +### Module Overview |
| 10 | + |
| 11 | +The ARC Terraform-aws-arc-lambda module provides a comprehensive and unified solution for deploying AWS Lambda serverless computing infrastructure on AWS. This versatile module supports multiple deployment methods including local source code, S3-based deployments, and container images, allowing you to choose the deployment approach that best fits your application requirements and operational needs. |
| 12 | + |
| 13 | +### Prerequisites |
| 14 | + |
| 15 | +Before using this module, ensure you have the following: |
| 16 | + |
| 17 | +- AWS credentials configured. |
| 18 | +- Terraform installed. |
| 19 | +- A working knowledge of AWS VPC, Docker and Terraform concepts. |
| 20 | + |
| 21 | +## Getting Started |
| 22 | + |
| 23 | +### Module Source |
| 24 | + |
| 25 | +To use the module in your Terraform configuration, include the following source block: |
| 26 | + |
| 27 | + |
| 28 | +```hcl |
| 29 | +module "lambda-function" { |
| 30 | + source = "sourcefuse/arc-lambda-function/aws" |
| 31 | + version = "0.0.1" |
| 32 | +
|
| 33 | + # Basic configuration |
| 34 | + function_name = var.function_name |
| 35 | + description = "Basic Lambda function example" |
| 36 | + runtime = "python3.11" |
| 37 | + handler = "lambda_function.lambda_handler" |
| 38 | + memory_size = 128 |
| 39 | + timeout = 10 |
| 40 | +
|
| 41 | + # Deployment package |
| 42 | + filename = data.archive_file.lambda_zip.output_path |
| 43 | + source_code_hash = data.archive_file.lambda_zip.output_base64sha256 |
| 44 | +
|
| 45 | + # Environment variables |
| 46 | + environment_variables = { |
| 47 | + ENVIRONMENT = var.environment |
| 48 | + LOG_LEVEL = var.log_level |
| 49 | + } |
| 50 | +
|
| 51 | + # CloudWatch Logs |
| 52 | + create_log_group = true |
| 53 | + log_retention_in_days = 7 |
| 54 | +
|
| 55 | + tags = module.tags.tags |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +Refer to the [Terraform Registry](https://registry.terraform.io/modules/sourcefuse/arc-lambda-function/aws/latest) for the latest version. |
| 60 | + |
| 61 | +### Integration with Existing Terraform Configurations |
| 62 | + |
| 63 | +Refer to the Terraform Registry for the latest version. |
| 64 | + |
| 65 | +## Integration with Existing Terraform Configurations |
| 66 | +Integrate the module with your existing Terraform mono repo configuration, follow the steps below: |
| 67 | + |
| 68 | +- Create a new folder in terraform/lambda-function named . |
| 69 | +- Create the required files, see the examples to base off of. |
| 70 | +- Configure with your backend: |
| 71 | + - Create the environment backend configuration file: config.<environment>.hcl |
| 72 | + - region: Where the backend resides |
| 73 | + - key: <working_directory>/terraform.tfstate |
| 74 | + - bucket: Bucket name where the terraform state will reside |
| 75 | + - dynamodb_table: Lock table so there are not duplicate tfplans in the mix |
| 76 | + - encrypt: Encrypt all traffic to and from the backend |
| 77 | + |
| 78 | +### Required AWS Permissions |
| 79 | + |
| 80 | +Ensure that the AWS credentials used to execute Terraform have the necessary permissions to create, list and modify: |
| 81 | + |
| 82 | +- All lambda-function services |
| 83 | +- VPC and networking configuration |
| 84 | + |
| 85 | +## Module Configuration |
| 86 | + |
| 87 | +### Input Variables |
| 88 | + |
| 89 | +For a list of input variables, see the README [Inputs](https://github.com/sourcefuse/terraform-aws-arc-lambda-function#inputs) section. |
| 90 | + |
| 91 | +### Output Values |
| 92 | + |
| 93 | +For a list of outputs, see the README [Outputs](https://github.com/sourcefuse/terraform-aws-arc-lambda-function?tab=readme-ov-file#outputs) section. |
| 94 | + |
| 95 | +## Module Usage |
| 96 | + |
| 97 | +### Basic Usage |
| 98 | + |
| 99 | +For basic usage, see the [examples](https://github.com/sourcefuse/terraform-aws-arc-lambda-function/tree/main/examples) folder. |
| 100 | + |
| 101 | +This example will create: |
| 102 | + |
| 103 | +- **lambda-function Studio Domain**: Complete |
| 104 | + |
| 105 | +### Tips and Recommendations |
| 106 | + |
| 107 | +- The module focuses on provisioning lambda-function. The convention-based approach enables downstream services to easily attach to the lambda-function. Adjust the configuration parameters as needed for your specific use case. |
| 108 | + |
| 109 | +## Troubleshooting |
| 110 | + |
| 111 | +### Reporting Issues |
| 112 | + |
| 113 | +If you encounter a bug or issue, please report it on the [GitHub repository](https://github.com/sourcefuse/terraform-aws-arc-lambda-function/issues). |
| 114 | + |
| 115 | +## Security Considerations |
| 116 | + |
| 117 | +### AWS VPC |
| 118 | + |
| 119 | +Understand the security considerations related to lambda-function on AWS when using this module. |
| 120 | + |
| 121 | +### Best Practices for AWS lambda-function |
| 122 | + |
| 123 | +Follow best practices to ensure secure lambda-function configurations: |
| 124 | + |
| 125 | +- [AWS lambda-function Security Best Practices](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html) |
| 126 | + |
| 127 | +## Contributing and Community Support |
| 128 | + |
| 129 | +### Contributing Guidelines |
| 130 | + |
| 131 | +Contribute to the module by following the guidelines outlined in the [CONTRIBUTING.md](https://github.com/sourcefuse/terraform-aws-arc-lambda-function/blob/main/CONTRIBUTING.md) file. |
| 132 | + |
| 133 | +### Reporting Bugs and Issues |
| 134 | + |
| 135 | +If you find a bug or issue, report it on the [GitHub repository](https://github.com/sourcefuse/terraform-aws-arc-lambda-function/issues). |
| 136 | + |
| 137 | +## License |
| 138 | + |
| 139 | +### License Information |
| 140 | + |
| 141 | +This module is licensed under the Apache 2.0 license. Refer to the [LICENSE](https://github.com/sourcefuse/terraform-aws-arc-lambda-function/blob/main/LICENSE) file for more details. |
| 142 | + |
| 143 | +### Open Source Contribution |
| 144 | + |
| 145 | +Contribute to open source by using and enhancing this module. Your contributions are welcome! |
0 commit comments