Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogoda committed Aug 23, 2024
1 parent 10e967e commit 088fca6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,26 @@ This module will deploy a Lambda function and a cron rule to run the Lambda func
- `lambda_role_policy` (string) - The Lambda IAM Role Policy.
- `lambda_env` - (string) - _optional_ - Environment parameters passed to the Lambda function.
- `tags` (map) - A mapping of tags to assign to this lambda function.
- `architectures (list) - _optional_ - The architectures supported by the Lambda function. Defaults to ["x86_64"].
- `architectures` (list) - _optional_ - The architectures supported by the Lambda function. Defaults to ["x86_64"].
- `use_default_security_group` (bool) - _optional_ - Whether to use the default security group for the Lambda function. Defaults to false.
- `vpce_id` (string) - _optional_ - The ID of the VPC endpoint to associate with the Lambda function.

## Usage

```hcl
module "lambda-function" {
source = "mergermarket/aws-lambda-cron/acuris"
version = "0.0.4"
s3_bucket = "s3_bucket_name"
s3_key = "s3_key_for_lambda"
function_name = "do_foo"
handler = "do_foo_handler"
runtime = "nodejs"
lambda_cron_schedule = "rate(5 minutes)"
lambda_env = "${var.lambda_env}"
architecture = ["arm64"]
source = "mergermarket/aws-lambda-cron/acuris"
version = "0.0.4"
s3_bucket = "s3_bucket_name"
s3_key = "s3_key_for_lambda"
function_name = "do_foo"
handler = "do_foo_handler"
runtime = "nodejs"
lambda_cron_schedule = "rate(5 minutes)"
lambda_env = "${var.lambda_env}"
architecture = ["arm64"]
vpc_id = module.platform_config.config["vpc"]
use_default_security_group = true
}
```
Lambda environment variables file:
Expand Down
4 changes: 2 additions & 2 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM python:3-alpine
COPY requirements.txt .

ENV TERRAFORM_VERSION=0.11.11
ENV TERRAFORM_VERSION=0.13.7
ENV TERRAFORM_ZIP=terraform_${TERRAFORM_VERSION}_linux_amd64.zip
ENV TERRAFORM_SUM=94504f4a67bad612b5c8e3a4b7ce6ca2772b3c1559630dfd71e9c519e3d6149c
ENV TERRAFORM_SUM=4a52886e019b4fdad2439da5ff43388bbcc6cce9784fde32c53dcd0e28ca9957

RUN apk add -U ca-certificates curl && \
cd /tmp && \
Expand Down
17 changes: 8 additions & 9 deletions test/infra/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
provider "aws" {
skip_credentials_validation = true
skip_metadata_api_check = true
skip_get_ec2_platforms = true
skip_region_validation = true
skip_requesting_account_id = true
max_retries = 1
Expand All @@ -17,12 +16,12 @@ module "lambda" {
function_name = "check_lambda_function"
handler = "some_handler"
runtime = "python2.7"
lambda_env = "${var.lambda_env}"
lambda_env = var.lambda_env
lambda_cron_schedule = "rate(5 minutes)"

subnet_ids = "${var.subnet_ids}"
security_group_ids = "${var.security_group_ids}"
tags = "${var.tags}"
subnet_ids = var.subnet_ids
security_group_ids = var.security_group_ids
tags = var.tags
}

module "lambda_long_name" {
Expand All @@ -32,11 +31,11 @@ module "lambda_long_name" {
function_name = "check_lambda_function_with_a_really_long_name_should_be_truncated"
handler = "some_handler"
runtime = "python2.7"
lambda_env = "${var.lambda_env}"
lambda_env = var.lambda_env
lambda_cron_schedule = "rate(5 minutes)"

subnet_ids = "${var.subnet_ids}"
security_group_ids = "${var.security_group_ids}"
subnet_ids = var.subnet_ids
security_group_ids = var.security_group_ids
}

variable "subnet_ids" {
Expand Down Expand Up @@ -64,5 +63,5 @@ variable "tags" {
}

output "lambda_function_arn" {
value = "${module.lambda.lambda_arn}"
value = module.lambda.lambda_arn
}
2 changes: 1 addition & 1 deletion test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pytest==3.0.7
pytest
1 change: 0 additions & 1 deletion test/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ repo_dir=$(git rev-parse --show-toplevel)
name=$(basename $repo_dir)-test

docker build -t $name $repo_dir/test

0 comments on commit 088fca6

Please sign in to comment.