Need help with your Cloud builds GET IN TOUCH.
Upon launching the following resources will be created:
- Lambda function
- Default CW log group: OPTIONAL
- Terraform v1.0.0 or higher
- AWS account
| Name | Version |
|---|---|
| aws | >= 5.0.0 |
No modules.
| Name | Type |
|---|---|
| aws_cloudwatch_log_group.loggroup | resource |
| aws_lambda_function.function | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| create_default_log_group | OPTIONAL: Whether to create default log group. Set to 1 to create | number |
1 |
no |
| environment_vars | Map of environment variables | map(string) |
null |
no |
| ephemeral_storage | The amount of Ephemeral storage(/tmp) to allocate for the Lambda Function in MB. | number |
"512" |
no |
| function | Lambda function variables - merged will locals to create configuration | map(any) |
null |
no |
| locals_function | n/a | object({ |
{ |
no |
| locals_s3 | n/a | object({ |
{ |
no |
| region | n/a | string |
"eu-west-1" |
no |
| retention_in_days | Log retention in dayes | number |
7 |
no |
| s3 | OPTIONAL: s3 object to specify function location in s3 - merged with locals to create configuration | map(any) |
null |
no |
| security_group_ids | OPTIONAL: The VPC security groups to assign to the Lambda. | list(string) |
[] |
no |
| subnet_ids | OPTIONAL: The VPC subnets in which the Lambda runs. | list(string) |
[] |
no |
| tags | Tags to assign to the Function | map(string) |
{} |
no |
| tracing_config | Tracing config. Can be either PassThrough or Active | string |
"Active" |
no |
| Name | Description |
|---|---|
| lambda_function | n/a |
To import the module add the following to your TF file:
module "lambda" {
source = "Cloud-42/lambda/aws"
version = "3.1.0" # Or required version
function = ({
name = var.function_name
role = var.function_role
handler = var.handler
filename = "./lambda.zip"
runtime = "python3.9"
memory_size = "512"
timeout = "600"
})
ephemeral_storage = "10240"
s3 = ({
bucket = "my-s3-source-bucket"
key = "file.jar.zip"
})
environment_vars = {
ENV_VAR = "${var.ENV_VAR}"
}
}
- To initialise the module run: terraform init
- To update the module run : terraform get --update
- To see a plan of changes : terraform plan
- To apply : terraform apply
- To automatically apply : terraform apply --auto-approve