Skip to content

Commit 9bee851

Browse files
set minimum version. #minor
1 parent 87a155c commit 9bee851

File tree

10 files changed

+161
-8
lines changed

10 files changed

+161
-8
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ end_of_line = lf
66
charset = utf-8
77
indent_style = space
88
indent_size = 4
9-
insert_final_newline = false
9+
insert_final_newline = true
1010
trim_trailing_whitespace = true
1111

1212
[*.py]

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
<a name="unreleased"></a>
22
## [Unreleased]
33

4+
<a name="v2.11.0"></a>
5+
## [v2.11.0] - 2020-05-17
46

7+
DOCS:
8+
- added example with tracing config
9+
10+
ENHANCEMENTS:
11+
- output `invoke_arn` to invoke the lambda
12+
13+
BREAKING CHANGES:
14+
- Minimun `aws` provider version is set to 2.5
515

616
<a name="v2.10.0"></a>
717
## [v2.10.0] - 2020-03-02

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ Here's the gist of using it via github.
2222

2323
```terraform
2424
module lambda {
25-
source = "github.com/terraform-module/terraform-aws-lambda?ref=v2.9.0"
25+
source = "terraform-module/lambda/aws"
26+
version = "2.10.0"
2627
27-
function_name = "lambda-to-deploy"
28-
filename = "${path.module}/lambda.zip"
28+
function_name = "lambda-name-to-deploy"
29+
filename = "${path.module}/lambda.zip"
2930
description = "description should be here"
3031
handler = "index.handler"
3132
runtime = "nodejs12.x"
@@ -34,6 +35,7 @@ module lambda {
3435
lambda_timeout = "20"
3536
log_retention = "1"
3637
role_arn = "some-role-arn"
38+
tracing_config = { mode = "Active" }
3739
3840
vpc_config = {
3941
subnet_ids = ["sb-q53asdfasdfasdf", "sf-3asdfasdfasdf6"]
@@ -58,13 +60,13 @@ module lambda {
5860
| Name | Version |
5961
|------|---------|
6062
| terraform | >= 0.12.9 |
61-
| aws | >= 2.52 |
63+
| aws | >= 2.5 |
6264

6365
## Providers
6466

6567
| Name | Version |
6668
|------|---------|
67-
| aws | >= 2.52 |
69+
| aws | >= 2.5 |
6870

6971
## Inputs
7072

examples/basic/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,3 @@ module lambda {
8383
Environment = "test"
8484
}
8585
}
86-

examples/tracing/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Examples
2+
3+
These serve a few purposes:
4+
5+
1. Shows developers how to use the module in a straightforward way as integrated with other terraform community supported modules.
6+
2. Serves as the test infrastructure for CI on the project.
7+
3. Provides a simple way to play with the Kubernetes cluster you create.
8+
9+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
10+
## Requirements
11+
12+
No requirements.
13+
14+
## Providers
15+
16+
| Name | Version |
17+
|------|---------|
18+
| archive | n/a |
19+
| aws | n/a |
20+
21+
## Inputs
22+
23+
| Name | Description | Type | Default | Required |
24+
|------|-------------|------|---------|:--------:|
25+
| full\_name | n/a | `string` | `"example"` | no |
26+
| region | n/a | `string` | `"us-west-2"` | no |
27+
28+
## Outputs
29+
30+
| Name | Description |
31+
|------|-------------|
32+
| lambda\_arn | ARN of the given lambda. |
33+
34+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/tracing/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exports.handler = (event, context, callback) => {
2+
console.log('Hello, lambda!');
3+
callback(null, 'success');
4+
}

examples/tracing/main.tf

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
provider "aws" {
2+
region = var.region
3+
}
4+
5+
data archive_file lambda {
6+
type = "zip"
7+
source_file = "index.js"
8+
output_path = "lambda_function.zip"
9+
}
10+
11+
12+
resource aws_iam_role iam {
13+
name = "iam_for_lambda_tf"
14+
15+
assume_role_policy = <<EOF
16+
{
17+
"Version": "2012-10-17",
18+
"Statement": [
19+
{
20+
"Action": "sts:AssumeRole",
21+
"Principal": {
22+
"Service": "lambda.amazonaws.com"
23+
},
24+
"Effect": "Allow",
25+
"Sid": ""
26+
}
27+
]
28+
}
29+
EOF
30+
}
31+
32+
resource aws_iam_policy trigger_transcoder {
33+
name = format("%s-trigger-transcoder", local.full_name)
34+
description = "Allow to access base resources and trigger transcoder"
35+
policy = <<EOF
36+
{
37+
"Version": "2012-10-17",
38+
"Statement": [
39+
{
40+
"Sid": "SomeVeryDefaultAndOpenActions",
41+
"Effect": "Allow",
42+
"Action": [
43+
"logs:CreateLogGroup",
44+
"ec2:DescribeNetworkInterfaces",
45+
"ec2:CreateNetworkInterface",
46+
"ec2:DeleteNetworkInterface",
47+
"logs:CreateLogStream",
48+
"logs:PutLogEvents"
49+
],
50+
"Resource": [
51+
"*"
52+
]
53+
}
54+
]
55+
}
56+
57+
EOF
58+
}
59+
module lambda {
60+
source = "terraform-module/lambda/aws"
61+
version = "2.11.0"
62+
63+
function_name = "lambda-to-deploy"
64+
filename = data.archive_file.lambda.output_path
65+
description = "description should be here"
66+
handler = "index.handler"
67+
runtime = "nodejs12.x"
68+
memory_size = "128"
69+
concurrency = "5"
70+
lambda_timeout = "20"
71+
log_retention = "1"
72+
role_arn = aws_iam_role.iam.arn
73+
74+
vpc_config = {
75+
subnet_ids = ["sb-q53asdfasdfasdf"]
76+
security_group_ids = ["sg-3asdfadsfasdfas"]
77+
}
78+
79+
environment = merge(local.lambda_env_vars,
80+
{ Environment = "test" })
81+
82+
tags = {
83+
Environment = "test"
84+
}
85+
}

examples/tracing/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "lambda_arn" {
2+
value = module.lambda.arn
3+
description = "ARN of the given lambda."
4+
}

examples/tracing/variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
variable "region" {
2+
default = "us-west-2"
3+
}
4+
variable "full_name" {
5+
default = "example"
6+
}
7+
8+
locals {
9+
10+
lambda_env_vars = {
11+
NODE_ENV = "production"
12+
AWS_XRAY_CONTEXT_MISSING = "LOG_ERROR"
13+
}
14+
15+
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ terraform {
22
required_version = ">= 0.12.9"
33

44
required_providers {
5-
aws = ">= 2.52"
5+
aws = ">= 2.5"
66
}
77
}

0 commit comments

Comments
 (0)