Module:
sourcefuse/arc-lambda-function/aws
Registry: https://registry.terraform.io/modules/sourcefuse/arc-lambda-function/aws
Category: Compute / Serverless
Source: https://github.com/sourcefuse/terraform-aws-arc-lambda-function
Tip
🤖 New: Use this module with AI assistants via the ARC IaC MCP Server — search, scaffold, and security-scan ARC modules from natural language. Quick setup ↓
Creates AWS Lambda functions with IAM roles, VPC configuration, environment variables, layers, event source mappings, and CloudWatch log groups.
- Lambda function with configurable runtime, handler, and memory
- Deployment from S3 or local zip file
- VPC configuration for private resource access
- Environment variables and SSM Parameter Store integration
- Lambda layers support
- Event source mappings (SQS, DynamoDB, Kinesis)
- Dead letter queue configuration
- X-Ray tracing
- CloudWatch log group with retention
For more information about this repository and its usage, please see Terraform AWS LAMBDA FUNCTION Usage Guide.
module "lambda-function" {
source = "sourcefuse/arc-lambda-function/aws"
version = "0.0.1"
# Basic configuration
function_name = var.function_name
description = "Basic Lambda function example"
runtime = "python3.11"
handler = "lambda_function.lambda_handler"
memory_size = 128
timeout = 10
# Deployment package
filename = data.archive_file.lambda_zip.output_path
source_code_hash = data.archive_file.lambda_zip.output_base64sha256
# Environment variables
environment_variables = {
ENVIRONMENT = var.environment
LOG_LEVEL = var.log_level
}
# CloudWatch Logs
create_log_group = true
log_retention_in_days = 7
tags = module.tags.tags
}| Name | Type | Description |
|---|---|---|
function_name |
string |
Lambda function name |
runtime |
string |
Runtime (e.g. python3.12, nodejs22.x) |
handler |
string |
Function handler (file.method) |
| Name | Description |
|---|---|
function_arn |
Lambda function ARN |
function_name |
Lambda function name |
invoke_arn |
Invoke ARN for API Gateway integration |
The complete inputs/outputs reference is auto-generated below.
uncomment the backend block in main.tf
terraform init -backend-config=config.dev.hclIf testing locally, terraform init should be fine
Create a dev workspace
terraform workspace new devPlan Terraform
terraform plan -var-file dev.tfvarsApply Terraform
terraform apply -var-file dev.tfvarsterraform init -backend-config=config.prod.hclCreate a prod workspace
terraform workspace new prodPlan Terraform
terraform plan -var-file prod.tfvarsApply Terraform
terraform apply -var-file prod.tfvars | Name | Version |
|---|---|
| terraform | >= 1.17.0 |
| archive | ~> 2.7 |
| aws | ~> 6.0 |
| Name | Version |
|---|---|
| aws | 6.73.0 |
No modules.
| Name | Type |
|---|---|
| aws_cloudwatch_log_group.lambda | resource |
| aws_iam_role.default | resource |
| aws_iam_role_policy.additional_policy_docs | resource |
| aws_iam_role_policy_attachment.additional | resource |
| aws_iam_role_policy_attachment.basic_execution | resource |
| aws_lambda_alias.this | resource |
| aws_lambda_function.this | resource |
| aws_lambda_function_url.this | resource |
| aws_lambda_permission.this | resource |
| aws_lambda_provisioned_concurrency_config.this | resource |
| aws_sqs_queue.dlq | resource |
| aws_iam_policy_document.assume_role | data source |
| aws_region.current | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| additional_policy_arns | List of additional IAM policy ARNs to attach to the Lambda role | list(string) |
[] |
no |
| additional_policy_docs | List of inline IAM policy JSON documents | list(string) |
[] |
no |
| alias_description | Description of the alias | string |
"Lambda function alias" |
no |
| alias_function_version | Lambda function version for which you are creating the alias | string |
null |
no |
| alias_name | Name for the alias | string |
"live" |
no |
| alias_routing_config | The Lambda alias routing configuration | object({ |
null |
no |
| architectures | Instruction set architecture for your Lambda function | list(string) |
[ |
no |
| code_signing_config_arn | ARN of code signing config | string |
null |
no |
| create_alias | Whether to create an alias for the Lambda function | bool |
false |
no |
| create_dlq | Whether to create a dead letter queue (SQS) for the Lambda function | bool |
false |
no |
| create_function_url | Whether to create a Lambda function URL | bool |
false |
no |
| create_log_group | Whether to create a CloudWatch log group for the Lambda function | bool |
true |
no |
| dead_letter_config | Dead letter queue configuration | object({ |
null |
no |
| description | Description of what your Lambda Function does | string |
"Lambda function created by Terraform" |
no |
| dlq_message_retention_seconds | The number of seconds Amazon SQS retains a message in the DLQ | number |
1209600 |
no |
| dlq_name | Name of the dead letter queue (if create_dlq is true) | string |
null |
no |
| environment_variables | Map of environment variables that are accessible from the function code during execution | map(string) |
{} |
no |
| ephemeral_storage | Ephemeral storage size in MB (512-10240) | number |
512 |
no |
| file_system_config | File system configuration for the Lambda function | object({ |
null |
no |
| filename | Path to the function's deployment package within the local filesystem | string |
null |
no |
| function_name | Name of the Lambda function | string |
n/a | yes |
| function_url_config | Lambda function URL configuration | object({ |
{ |
no |
| handler | Function entrypoint in your code | string |
"index.handler" |
no |
| image_config | Configuration for Lambda when using container images | object({ |
null |
no |
| image_uri | ECR image URI containing the function's deployment package | string |
null |
no |
| kms_key_arn | Amazon Resource Name (ARN) of the AWS Key Management Service (KMS) key that's used to encrypt your function's environment variables | string |
null |
no |
| lambda_insights_enabled | Whether to enable Lambda Insights for the function | bool |
false |
no |
| lambda_insights_version | Version of the Lambda Insights layer | string |
"1" |
no |
| lambda_permissions | Map of Lambda permissions to create | map(object({ |
{} |
no |
| log_group_kms_key_id | The ARN of the KMS Key to use when encrypting log data | string |
null |
no |
| log_group_name | Name of the CloudWatch log group | string |
null |
no |
| log_retention_in_days | Specifies the number of days you want to retain log events in the specified log group | number |
14 |
no |
| logging_config | Logging configuration for Lambda function | object({ |
null |
no |
| memory_size | Amount of memory in MB your Lambda Function can use at runtime | number |
128 |
no |
| package_type | Lambda deployment package type (Zip or Image) | string |
"Zip" |
no |
| provisioned_concurrency_config | Provisioned concurrency configuration | object({ |
null |
no |
| publish | Whether to publish creation/change as new Lambda Function Version | bool |
false |
no |
| replace_security_groups_on_destroy | Whether to force replacement of security groups on destroy | bool |
false |
no |
| replacement_security_group_ids | List of replacement security group IDs to use | list(string) |
[] |
no |
| reserved_concurrent_executions | Amount of reserved concurrent executions for this lambda function | number |
-1 |
no |
| role_arn | Existing IAM role ARN to use. If null, a default role will be created. | string |
null |
no |
| runtime | Runtime for the Lambda function (e.g., python3.9, nodejs18.x, java11, etc.) | string |
"python3.12" |
no |
| s3_bucket | S3 bucket location containing the function's deployment package | string |
null |
no |
| s3_key | S3 key of an object containing the function's deployment package | string |
null |
no |
| s3_object_version | Object version containing the function's deployment package | string |
null |
no |
| snap_start | SnapStart configuration for Lambda function | object({ |
null |
no |
| source_code_hash | Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key | string |
null |
no |
| tags | A map of tags to assign to the resource | map(string) |
{} |
no |
| timeout | Amount of time your Lambda Function has to run in seconds | number |
3 |
no |
| tracing_config | Tracing configuration for Lambda function | object({ |
null |
no |
| vpc_config | VPC configuration for the Lambda function | object({ |
null |
no |
| Name | Description |
|---|---|
| alias_arn | The Amazon Resource Name (ARN) identifying the Lambda function alias |
| alias_description | Description of the Lambda function alias |
| alias_function_version | Lambda function version which the alias uses |
| alias_invoke_arn | The ARN to be used for invoking Lambda Function alias from API Gateway |
| alias_name | The name of the Lambda function alias |
| arn | The Amazon Resource Name (ARN) identifying your Lambda Function |
| cloudwatch_log_group_arn | The Amazon Resource Name (ARN) specifying the log group |
| cloudwatch_log_group_name | The name of the CloudWatch Log Group |
| dead_letter_queue_arn | The ARN of the SQS queue used as dead letter queue |
| dead_letter_queue_name | The name of the SQS queue used as dead letter queue |
| dead_letter_queue_url | The URL of the SQS queue used as dead letter queue |
| environment_variables | The Lambda function environment variables |
| invoke_arn | The ARN to be used for invoking Lambda Function from API Gateway |
| kms_key_arn | The ARN of the KMS Key used to encrypt your Lambda Function's environment variables |
| last_modified | The date this resource was last modified |
| name | The name of the Lambda Function |
| provisioned_concurrency_config_id | The ID of the provisioned concurrency configuration |
| qualified_arn | The Amazon Resource Name (ARN) identifying your Lambda Function Version |
| role_arn | ARN of the IAM role used by the Lambda function. If an existing role ARN is provided via var.role_arn, it is used; otherwise, the default role created in this module is returned. |
| signing_job_arn | ARN of the signing job |
| signing_profile_version_arn | ARN of the signing profile version |
| source_code_size | The size in bytes of the function .zip file |
| url | The HTTP URL endpoint for the Lambda function |
| url_id | The generated ID for the endpoint |
| version | Latest published version of your Lambda Function |
| vpc_config | The Lambda function VPC configuration |
This project uses a .version file at the root of the repo which the pipeline reads from and does a git tag.
When you intend to commit to main, you will need to increment this version. Once the project is merged,
the pipeline will kick off and tag the latest git commit.
- Configure pre-commit hooks
pre-commit install
while Contributing or doing git commit please specify the breaking change in your commit message whether its major,minor or patch
For Example
git commit -m "your commit message #major"By specifying this , it will bump the version and if you don't specify this in your commit message then by default it will consider patch and will bump that accordingly
- Tests are available in
testdirectory - Configure the dependencies
cd test/ go mod init github.com/sourcefuse/terraform-aws-refarch-<module_name> go get github.com/gruntwork-io/terratest/modules/terraform
- Now execute the test
go test -timeout 30m
The ARC IaC MCP Server is a hosted Model Context Protocol service that lets AI assistants browse, search, scaffold, compare, and security-scan any of the SourceFuse ARC Terraform modules — directly from natural language.
What you can do with it:
- Discover — search and filter modules by keyword or AWS resource type.
- Understand — get inputs, outputs, and resources for any module without leaving your editor.
- Scaffold — generate production-ready, multi-file Terraform with cross-module wiring already done.
- Secure — scan generated or existing HCL for misconfigurations before it hits a PR.
- Compare — diff modules side-by-side to make informed architectural decisions.
The MCP endpoint is https://arc-iac-mcp.sourcef.us/mcp. Pick your client:
Claude Code CLI:
claude mcp add arc-iac --transport http https://arc-iac-mcp.sourcef.us/mcpClaude Desktop — edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"arc-iac": {
"url": "https://arc-iac-mcp.sourcef.us/mcp"
}
}
}Cursor / Windsurf / Kiro — add the same block to .cursor/mcp.json (or the equivalent for your client).
- "List all ARC modules sorted by downloads"
- "What inputs does
arc-ecsrequire?" - "Scaffold a production-ready
arc-dbAurora setup with Secrets Manager" - "Compare
arc-eksandarc-ecsfor running 10 microservices" - "Scan this Terraform before I raise a PR:
<paste HCL>"
See the ARC IaC MCP repo for the full tool reference, troubleshooting tips, and local-development instructions.
See CONTRIBUTING.md for commit conventions and development setup.
This project is authored by:
- SourceFuse ARC Team

