terraform-aws-dotnet-lambda
Terraform module to create a dotnet lambda function locally
This module utilizes the dotnet
runtime CLI locally to package the lambda and automatically upload it to AWS.
This module was created as an experiment to see if it was possible and gain a deeper understanding of terraform. It may not work and comes with no guarantees.
https://blog.dmichael.be/2022/09/28/Terraform-External-Data-Provider-and-local-exec-Provisioner/
Currently this uses a bash script to package the lambda. It will not work unless under WSL on Windows.
Requirements
Name | Version |
---|---|
terraform | >= 1.2.0 |
Providers
Name | Version |
---|---|
aws | 4.31.0 |
external | 2.2.2 |
null | 3.1.1 |
Modules
No modules.
Resources
Name | Type |
---|---|
aws_cloudwatch_log_group.example | resource |
aws_iam_role.this | resource |
aws_iam_role_policy_attachment.lambda_logs | resource |
aws_kms_key.key | resource |
aws_lambda_function.this | resource |
null_resource.create_package | resource |
external_external.build_folder | data source |
Inputs
Name | Description | Type | Default | Required |
---|---|---|---|---|
architecture | The architecture of the Lambda function. Valid values are x86_64 and arm64. | string |
"x86_64" |
no |
code_location | The location of the dotnet code for the lambda function | string |
"src/" |
no |
create_function | Controls whether Lambda Function resource should be created | bool |
true |
no |
create_key | Whether to create a KMS key for the Lambda function. | bool |
false |
no |
create_role | Whether to create a role for the Lambda function. | bool |
true |
no |
description | Description of what your Lambda Function does | string |
"" |
no |
dotnet_runtime | Dotnet runtime version for lambda to use | string |
"dotnet6" |
no |
function_name | The name of the function. | string |
n/a | yes |
handler | Lambda Function entrypoint in your code | string |
"" |
no |
log_retention | The number of days you want to retain log events in the specified log group. | number |
30 |
no |
memory_size | The amount of memory, in MB, your Lambda Function can use at runtime. Defaults to 128 MB. The value must be a multiple of 64 MB. | number |
128 |
no |
role_arn | The ARN of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources. | string |
"" |
no |
tracing_mode | The tracing mode of the Lambda function. Valid values are Active and PassThrough. | string |
"PassThrough" |
no |
Outputs
Name | Description |
---|---|
lambda_function_arn | n/a |
lambda_function_role_arn | n/a |