Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrix Roa committed Dec 27, 2019
1 parent 2d675d6 commit 87a32ee
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Lambda Node.js + yarn

Lambda Module with the best security practice prebuilt with yarn installing to add custom modules and libreries from npmjs.com, ideally to integrate to CI/CD pipeline. Some features:

- Integrated with S3 bucket to deploy latest version and compare if a lambda require update.
- Best security best practices witn encryption features.
- Easy handle to packaging zip + node_modules folder.
- Terraform `0.12.+`

## How to use

```hcl
module "my-lambda" {
source = "hendrixroa/lambda-nodejs-yarn/aws"
code_location = "../mylambdas/lambda"
key_s3_bucket = "lambda.zip"
s3_bucket_id = aws_s3_bucket.lambdas.id
lambda_iam_role = aws_iam_role.lambda_basic_role.arn
lambda_function_name = "lambda"
lambda_runtime = "nodejs10.x"
kms_key_logs = "kms key arn for logs"
kms_key_lambda = "kms key arn for lambda"
environment_variables = {
myAwesomeEnv = "my awesome value"
}
}
```

- Basic IAM Role and Policy:

```hcl
resource "aws_iam_role" "lambda_basic_role" {
name = "lambda_basic_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Effect": "Allow"
}
]
}
EOF
}
resource "aws_iam_role_policy" "lambda_basic_policy" {
name = "lambda_basic_policy"
role = aws_iam_role.lambda_basic_role.id
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": [
"arn:aws:logs:*:*:*"
]
}
]
}
EOF
}
```

0 comments on commit 87a32ee

Please sign in to comment.