Skip to content

Commit 5601d3e

Browse files
author
Keir Badger
authored
Merge pull request #8 from jheister/master
Support container based lambdas by optionally providing image_uri or …
2 parents 4568c74 + 6541720 commit 5601d3e

File tree

6 files changed

+54
-2
lines changed

6 files changed

+54
-2
lines changed

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ terraform {
33
}
44

55
resource "aws_lambda_function" "lambda_function" {
6-
s3_bucket = var.s3_bucket
7-
s3_key = var.s3_key
6+
image_uri = var.image_uri != "" ? var.image_uri : null
7+
s3_bucket = var.s3_bucket != "" ? var.s3_bucket : null
8+
s3_key = var.s3_key != "" ? var.s3_key : null
89
function_name = var.function_name
910
role = aws_iam_role.iam_for_lambda.arn
1011
handler = var.handler

test/files/create_lambda.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
"arn": true,
5252
"create_date": true,
5353
"id": true,
54+
"inline_policy": true,
55+
"managed_policy_arns": true,
5456
"name": true,
5557
"unique_id": true
5658
}
@@ -92,19 +94,24 @@
9294
],
9395
"before": null,
9496
"after": {
97+
"code_signing_config_arn": null,
9598
"dead_letter_config": [],
9699
"description": null,
97100
"environment": [
98101
{
99102
"variables": null
100103
}
101104
],
105+
"file_system_config": [],
102106
"filename": null,
103107
"function_name": "check_lambda_function",
104108
"handler": "some_handler",
109+
"image_config": [],
110+
"image_uri": null,
105111
"kms_key_arn": null,
106112
"layers": null,
107113
"memory_size": 128,
114+
"package_type": "Zip",
108115
"publish": false,
109116
"reserved_concurrent_executions": -1,
110117
"runtime": "python3.7",
@@ -127,11 +134,15 @@
127134
"environment": [
128135
{}
129136
],
137+
"file_system_config": [],
130138
"id": true,
139+
"image_config": [],
131140
"invoke_arn": true,
132141
"last_modified": true,
133142
"qualified_arn": true,
134143
"role": true,
144+
"signing_job_arn": true,
145+
"signing_profile_version_arn": true,
135146
"source_code_hash": true,
136147
"source_code_size": true,
137148
"tracing_config": true,

test/files/create_lambda_in_vpc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
"arn": true,
5252
"create_date": true,
5353
"id": true,
54+
"inline_policy": true,
55+
"managed_policy_arns": true,
5456
"name": true,
5557
"unique_id": true
5658
}
@@ -114,19 +116,24 @@
114116
],
115117
"before": null,
116118
"after": {
119+
"code_signing_config_arn": null,
117120
"dead_letter_config": [],
118121
"description": null,
119122
"environment": [
120123
{
121124
"variables": null
122125
}
123126
],
127+
"file_system_config": [],
124128
"filename": null,
125129
"function_name": "check_lambda_function",
126130
"handler": "some_handler",
131+
"image_config": [],
132+
"image_uri": null,
127133
"kms_key_arn": null,
128134
"layers": null,
129135
"memory_size": 128,
136+
"package_type": "Zip",
130137
"publish": false,
131138
"reserved_concurrent_executions": -1,
132139
"runtime": "python3.7",
@@ -155,11 +162,15 @@
155162
"environment": [
156163
{}
157164
],
165+
"file_system_config": [],
158166
"id": true,
167+
"image_config": [],
159168
"invoke_arn": true,
160169
"last_modified": true,
161170
"qualified_arn": true,
162171
"role": true,
172+
"signing_job_arn": true,
173+
"signing_profile_version_arn": true,
163174
"source_code_hash": true,
164175
"source_code_size": true,
165176
"tracing_config": true,

test/files/create_lambda_with_reserved_concurrent_executions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
"arn": true,
5252
"create_date": true,
5353
"id": true,
54+
"inline_policy": true,
55+
"managed_policy_arns": true,
5456
"name": true,
5557
"unique_id": true
5658
}
@@ -92,19 +94,24 @@
9294
],
9395
"before": null,
9496
"after": {
97+
"code_signing_config_arn": null,
9598
"dead_letter_config": [],
9699
"description": null,
97100
"environment": [
98101
{
99102
"variables": null
100103
}
101104
],
105+
"file_system_config": [],
102106
"filename": null,
103107
"function_name": "check_lambda_function",
104108
"handler": "some_handler",
109+
"image_config": [],
110+
"image_uri": null,
105111
"kms_key_arn": null,
106112
"layers": null,
107113
"memory_size": 128,
114+
"package_type": "Zip",
108115
"publish": false,
109116
"reserved_concurrent_executions": 3,
110117
"runtime": "python3.7",
@@ -127,11 +134,15 @@
127134
"environment": [
128135
{}
129136
],
137+
"file_system_config": [],
130138
"id": true,
139+
"image_config": [],
131140
"invoke_arn": true,
132141
"last_modified": true,
133142
"qualified_arn": true,
134143
"role": true,
144+
"signing_job_arn": true,
145+
"signing_profile_version_arn": true,
135146
"source_code_hash": true,
136147
"source_code_size": true,
137148
"tracing_config": true,

test/files/create_lambda_with_tags.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
"arn": true,
5252
"create_date": true,
5353
"id": true,
54+
"inline_policy": true,
55+
"managed_policy_arns": true,
5456
"name": true,
5557
"unique_id": true
5658
}
@@ -92,19 +94,24 @@
9294
],
9395
"before": null,
9496
"after": {
97+
"code_signing_config_arn": null,
9598
"dead_letter_config": [],
9699
"description": null,
97100
"environment": [
98101
{
99102
"variables": null
100103
}
101104
],
105+
"file_system_config": [],
102106
"filename": null,
103107
"function_name": "check_lambda_function",
104108
"handler": "some_handler",
109+
"image_config": [],
110+
"image_uri": null,
105111
"kms_key_arn": null,
106112
"layers": null,
107113
"memory_size": 128,
114+
"package_type": "Zip",
108115
"publish": false,
109116
"reserved_concurrent_executions": -1,
110117
"runtime": "python3.7",
@@ -130,11 +137,15 @@
130137
"environment": [
131138
{}
132139
],
140+
"file_system_config": [],
133141
"id": true,
142+
"image_config": [],
134143
"invoke_arn": true,
135144
"last_modified": true,
136145
"qualified_arn": true,
137146
"role": true,
147+
"signing_job_arn": true,
148+
"signing_profile_version_arn": true,
138149
"source_code_hash": true,
139150
"source_code_size": true,
140151
"tags": {},

variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
variable "image_uri" {
2+
description = "Optional ECR image (for image based lambda)"
3+
default = ""
4+
}
5+
16
variable "s3_bucket" {
27
description = "The name of the bucket containing your uploaded Lambda deployment package."
8+
default = ""
39
}
410

511
variable "s3_key" {
612
description = "The s3 key for your Lambda deployment package."
13+
default = ""
714
}
815

916
variable "function_name" {

0 commit comments

Comments
 (0)