You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 8, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+48-7Lines changed: 48 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ This Terraform module creates and uploads an AWS Lambda function and hides the u
23
23
| 1.x.x | 0.12.x |
24
24
| 0.x.x | 0.11.x |
25
25
26
+
26
27
## Usage
27
28
28
29
```js
@@ -65,20 +66,60 @@ module "lambda" {
65
66
}
66
67
}
67
68
```
69
+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
70
+
## Providers
68
71
69
-
## Inputs
72
+
| Name | Version |
73
+
|------|---------|
74
+
| aws | n/a |
75
+
| external | n/a |
76
+
| null | n/a |
70
77
71
-
Inputs for this module are the same as the [aws_lambda_function](https://www.terraform.io/docs/providers/aws/r/lambda_function.html) resource with the following additional arguments:
78
+
## Inputs
72
79
73
80
| Name | Description | Type | Default | Required |
| log\_group\_kms\_key\_id | The ID of a KMS key to use for encrypting the logs for the log group used by the Lambda if create\_log\_group is enabled. |`string`| n/a | yes |
90
+
| log\_group\_retention | The retention time of the Cloudwatch Log group that the Lambda logs to if create\_log\_group is enabled. |`string`| n/a | yes |
91
+
| log\_group\_tags | The tags to assign to the log group for the Lambda if create\_log\_group is enabled. This needs to be a list of maps of strings. |`list(map(string))`| n/a | yes |
92
+
| memory\_size | n/a |`number`| n/a | yes |
93
+
| policy | An additional policy to attach to the Lambda function role | <pre>object({<br> json = string<br> })</pre> | n/a | yes |
| build\_command | The command to run to create the Lambda package zip file |`string`|`"python build.py '$filename' '$runtime' '$source'"`| no |
77
-
| build\_paths | The files or directories used by the build command, to trigger new Lambda package builds whenever build scripts change |`list(string)`|`["build.py"]`| no |
101
+
| build\_paths | The files or directories used by the build command, to trigger new Lambda package builds whenever build scripts change |`list(string)`|<pre>[<br> "build.py"<br>]</pre>| no |
78
102
| cloudwatch\_logs | Set this to false to disable logging your Lambda output to CloudWatch Logs |`bool`|`true`| no |
103
+
| create\_log\_group | Whether or not to create the log group for the Lambda function. If the Lambda has been ran with logging enabled prior to this option being enabled Terraform will fail as the log group will already exist. In this case you will have to import the log group using a command like: terraform import module.lambda.aws\_cloudwatch\_log\_group.lambda /aws/lambda/lambda\_function\_name. Also note that if you disable this option or remove the module Terraform will want to remove the log group and it's associated logs. To keep the log group and its logs please ensure that you either remove module.lambda.aws\_cloudwatch\_log\_group.lambda from the state or move it to somewhere else in the state using either terraform state rm or terraform state mv. |`bool`|`false`| no |
79
104
| lambda\_at\_edge | Set this to true if using Lambda@Edge, to enable publishing, limit the timeout, and allow edgelambda.amazonaws.com to invoke the function |`bool`|`false`| no |
80
-
| policy | An additional policy to attach to the Lambda function role |`object({json=string})`|| no |
81
-
| trusted\_entities | Additional trusted entities for the Lambda function. The lambda.amazonaws.com (and edgelambda.amazonaws.com if lambda\_at\_edge is true) is always set |`list(string)`|| no |
105
+
| publish | n/a |`bool`|`false`| no |
106
+
| timeout | n/a |`number`|`3`| no |
107
+
| trusted\_entities | Lambda function additional trusted entities for assuming roles (trust relationship) |`list(string)`|`[]`| no |
108
+
109
+
## Outputs
110
+
111
+
| Name | Description |
112
+
|------|-------------|
113
+
| cloudwatch\_log\_group\_arn | The ARN of the log group created for this Lambda if logging is enabled. |
114
+
| cloudwatch\_log\_group\_name | The name of the log group created for this Lambda if logging is enabled. |
115
+
| function\_arn | The ARN of the Lambda function |
116
+
| function\_invoke\_arn | The Invoke ARN of the Lambda function |
117
+
| function\_name | The name of the Lambda function |
118
+
| function\_qualified\_arn | The qualified ARN of the Lambda function |
119
+
| role\_arn | The ARN of the IAM role created for the Lambda function |
120
+
| role\_name | The name of the IAM role created for the Lambda function |
121
+
122
+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
82
123
83
124
The following arguments from the [aws_lambda_function](https://www.terraform.io/docs/providers/aws/r/lambda_function.html) resource are not supported:
Copy file name to clipboardExpand all lines: variables.tf
+25-2Lines changed: 25 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,29 @@ variable "cloudwatch_logs" {
37
37
default=true
38
38
}
39
39
40
+
variable"create_log_group" {
41
+
description="Whether or not to create the log group for the Lambda function. If the Lambda has been ran with logging enabled prior to this option being enabled Terraform will fail as the log group will already exist. In this case you will have to import the log group using a command like: terraform import module.lambda.aws_cloudwatch_log_group.lambda /aws/lambda/lambda_function_name. Also note that if you disable this option or remove the module Terraform will want to remove the log group and it's associated logs. To keep the log group and its logs please ensure that you either remove module.lambda.aws_cloudwatch_log_group.lambda from the state or move it to somewhere else in the state using either terraform state rm or terraform state mv."
42
+
type=bool
43
+
default=false
44
+
}
45
+
variable"log_group_retention" {
46
+
description="The retention time of the Cloudwatch Log group that the Lambda logs to if create_log_group is enabled."
47
+
type=string
48
+
default=null
49
+
}
50
+
51
+
variable"log_group_kms_key_id" {
52
+
description="The ID of a KMS key to use for encrypting the logs for the log group used by the Lambda if create_log_group is enabled."
53
+
type=string
54
+
default=null
55
+
}
56
+
57
+
variable"log_group_tags" {
58
+
description="The tags to assign to the log group for the Lambda if create_log_group is enabled. This needs to be a list of maps of strings."
59
+
type=list(map(string))
60
+
default=null
61
+
}
62
+
40
63
variable"lambda_at_edge" {
41
64
description="Set this to true if using Lambda@Edge, to enable publishing, limit the timeout, and allow edgelambda.amazonaws.com to invoke the function"
42
65
type=bool
@@ -53,8 +76,8 @@ variable "policy" {
53
76
54
77
variable"trusted_entities" {
55
78
description="Lambda function additional trusted entities for assuming roles (trust relationship)"
0 commit comments