Skip to content

Commit 1e9fdfe

Browse files
feat: Docker Image Attach (#10)
* Docker image attach variables added --------- Co-authored-by: meetsheth23 <meetsheth2311@gmail.com>
1 parent 4745725 commit 1e9fdfe

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

EXAMPLE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,19 @@ module "lambda_test" {
6767
description = "Test lambda"
6868
logs_retention = 14
6969
}
70+
```
71+
72+
## Create Lambda function from docker image
73+
```
74+
module "lambda_test" {
75+
source = "git::https://github.com/TechHoldingLLC/terraform-aws-lambda-function.git"
76+
77+
function_name = "my-lambda"
78+
lambda_timeout = 60 #seconds
79+
image_uri = "image_uri:image_tag"
80+
package_type = "Image"
81+
environment_variables = {
82+
BAR = "FOO"
83+
}
84+
}
7085
```

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ No modules.
4444
| <a name="input_apigw_execution_arn"></a> [apigw\_execution\_arn](#input\_apigw\_execution\_arn) | Apigw execution arn | `list` | `[]` | no |
4545
| <a name="input_cloudwatch_scheduler_arn"></a> [cloudwatch\_scheduler\_arn](#input\_cloudwatch\_scheduler\_arn) | Cloudwatch scheduler arn | `string` | `""` | no |
4646
| <a name="input_cognito_pool_arn"></a> [cognito\_pool\_arn](#input\_cognito\_pool\_arn) | Cognito pool arn | `string` | `""` | no |
47-
| <a name="input_description"></a> [description](#input\_description) | Lambda function description | `any` | n/a | yes |
47+
| <a name="input_description"></a> [description](#input\_description) | Lambda function description | `any` | `null` | no |
4848
| <a name="input_enable_api_invoke_permission"></a> [enable\_api\_invoke\_permission](#input\_enable\_api\_invoke\_permission) | Enable api invoke permission | `bool` | `false` | no |
4949
| <a name="input_enable_cognito_invoke_permission"></a> [enable\_cognito\_invoke\_permission](#input\_enable\_cognito\_invoke\_permission) | Enable cognito invoke permission | `bool` | `false` | no |
5050
| <a name="input_enable_eventbridge_invoke_permission"></a> [enable\_eventbridge\_invoke\_permission](#input\_enable\_eventbridge\_invoke\_permission) | Enable eventbridge invoke permission | `bool` | `false` | no |
@@ -56,14 +56,16 @@ No modules.
5656
| <a name="input_eventbridge_rule_arn"></a> [eventbridge\_rule\_arn](#input\_eventbridge\_rule\_arn) | Eventbridge rule arn | `string` | `""` | no |
5757
| <a name="input_function_name"></a> [function\_name](#input\_function\_name) | Lambda function name | `any` | n/a | yes |
5858
| <a name="input_function_url"></a> [function\_url](#input\_function\_url) | Create lambda function url | `bool` | `false` | no |
59-
| <a name="input_function_url_cors"></a> [function\_url\_cors](#input\_function\_url\_cors) | Function url cors | `any` | `[]` | no |
60-
| <a name="input_handler"></a> [handler](#input\_handler) | Name of Handler | `any` | n/a | yes |
59+
| <a name="input_function_url_cors"></a> [function\_url\_cors](#input\_function\_url\_cors) | Function url cors | `any` | `{}` | no |
60+
| <a name="input_handler"></a> [handler](#input\_handler) | Name of Handler | `any` | `null` | no |
61+
| <a name="input_image_uri"></a> [image\_uri](#input\_image\_uri) | uri of image | `any` | `null` | no |
6162
| <a name="input_lambda_memory"></a> [lambda\_memory](#input\_lambda\_memory) | Required Memory for Lambda function | `number` | `128` | no |
62-
| <a name="input_lambda_runtime"></a> [lambda\_runtime](#input\_lambda\_runtime) | Lambda language | `any` | n/a | yes |
63+
| <a name="input_lambda_runtime"></a> [lambda\_runtime](#input\_lambda\_runtime) | Lambda language | `any` | `null` | no |
6364
| <a name="input_lambda_timeout"></a> [lambda\_timeout](#input\_lambda\_timeout) | Required Timeout for Lambda function | `number` | `5` | no |
6465
| <a name="input_layers_arn"></a> [layers\_arn](#input\_layers\_arn) | Lambda layer arn | `list(string)` | `null` | no |
6566
| <a name="input_logs_retention"></a> [logs\_retention](#input\_logs\_retention) | Specifies the number of days you want to retain log events in the specified log group | `number` | `null` | no |
6667
| <a name="input_output_path"></a> [output\_path](#input\_output\_path) | The name for the zip file created with the file described in source\_file | `string` | `""` | no |
68+
| <a name="input_package_type"></a> [package\_type](#input\_package\_type) | type of package | `any` | `null` | no |
6769
| <a name="input_prefix"></a> [prefix](#input\_prefix) | Prefix for resources | `string` | `""` | no |
6870
| <a name="input_publish"></a> [publish](#input\_publish) | Publish lambda function version | `bool` | `false` | no |
6971
| <a name="input_s3_bucket"></a> [s3\_bucket](#input\_s3\_bucket) | Lambda artifacts bucket | `string` | `""` | no |
@@ -73,6 +75,7 @@ No modules.
7375
| <a name="input_source_file"></a> [source\_file](#input\_source\_file) | Lambda source file | `string` | `""` | no |
7476
| <a name="input_sqs_queue_arn"></a> [sqs\_queue\_arn](#input\_sqs\_queue\_arn) | SQS queue arn | `string` | `""` | no |
7577
| <a name="input_subnets"></a> [subnets](#input\_subnets) | Subnets | `list(any)` | `null` | no |
78+
| <a name="input_tags"></a> [tags](#input\_tags) | Tags | `map` | `{}` | no |
7679

7780
## Outputs
7881

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ resource "aws_lambda_function" "lambda" {
4747
s3_object_version = try(data.aws_s3_object.lambda[0].version_id, null)
4848
source_code_hash = try(data.aws_s3_object.lambda[0].metadata.source_code_hash, null)
4949
filename = try(data.archive_file.lambda[0].output_path, null)
50+
image_uri = var.image_uri
51+
package_type = var.package_type
5052
layers = var.layers_arn
5153
publish = var.publish
5254

variables.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ variable "function_url_cors" {
2323

2424
variable "description" {
2525
description = "Lambda function description"
26+
default = null
2627
}
2728

2829
variable "environment_variables" {
@@ -37,6 +38,17 @@ variable "function_name" {
3738

3839
variable "handler" {
3940
description = "Name of Handler"
41+
default = null
42+
}
43+
44+
variable "image_uri" {
45+
description = "uri of image"
46+
default = null
47+
}
48+
49+
variable "package_type" {
50+
description = "type of package"
51+
default = null
4052
}
4153

4254
variable "s3_bucket" {
@@ -51,6 +63,7 @@ variable "lambda_memory" {
5163

5264
variable "lambda_runtime" {
5365
description = "Lambda language"
66+
default = null
5467
}
5568

5669
variable "layers_arn" {

0 commit comments

Comments
 (0)