Skip to content

Commit 71c329c

Browse files
3h4xcloudpossebotnitrocode
authored
Added dead_letter_config (#15)
* Added dead_letter_config Co-authored-by: cloudpossebot <[email protected]> Co-authored-by: nitrocode <[email protected]>
1 parent e5ca387 commit 71c329c

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

.github/renovate.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
":preserveSemverRanges"
55
],
66
"labels": ["auto-update"],
7+
"dependencyDashboardAutoclose": true,
78
"enabledManagers": ["terraform"],
89
"terraform": {
910
"ignorePaths": ["**/context.tf", "examples/**"]
1011
}
1112
}
12-

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ Available targets:
187187
| <a name="input_cloudwatch_logs_retention_in_days"></a> [cloudwatch\_logs\_retention\_in\_days](#input\_cloudwatch\_logs\_retention\_in\_days) | Specifies the number of days you want to retain log events in the specified log group. Possible values are: <br> 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653, and 0. If you select 0, the events in the <br> log group are always retained and never expire. | `number` | `null` | no |
188188
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "descriptor_formats": {},<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |
189189
| <a name="input_custom_iam_policy_arns"></a> [custom\_iam\_policy\_arns](#input\_custom\_iam\_policy\_arns) | ARNs of custom policies to be attached to the lambda role | `set(string)` | `[]` | no |
190+
| <a name="input_dead_letter_config_target_arn"></a> [dead\_letter\_config\_target\_arn](#input\_dead\_letter\_config\_target\_arn) | ARN of an SNS topic or SQS queue to notify when an invocation fails. If this option is used, the function's IAM role <br> must be granted suitable access to write to the target object, which means allowing either the sns:Publish or <br> sqs:SendMessage action on this ARN, depending on which service is targeted." | `string` | `null` | no |
190191
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
191192
| <a name="input_description"></a> [description](#input\_description) | Description of what the Lambda Function does. | `string` | `null` | no |
192193
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |

docs/terraform.md

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
| <a name="input_cloudwatch_logs_retention_in_days"></a> [cloudwatch\_logs\_retention\_in\_days](#input\_cloudwatch\_logs\_retention\_in\_days) | Specifies the number of days you want to retain log events in the specified log group. Possible values are: <br> 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653, and 0. If you select 0, the events in the <br> log group are always retained and never expire. | `number` | `null` | no |
5353
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "descriptor_formats": {},<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |
5454
| <a name="input_custom_iam_policy_arns"></a> [custom\_iam\_policy\_arns](#input\_custom\_iam\_policy\_arns) | ARNs of custom policies to be attached to the lambda role | `set(string)` | `[]` | no |
55+
| <a name="input_dead_letter_config_target_arn"></a> [dead\_letter\_config\_target\_arn](#input\_dead\_letter\_config\_target\_arn) | ARN of an SNS topic or SQS queue to notify when an invocation fails. If this option is used, the function's IAM role <br> must be granted suitable access to write to the target object, which means allowing either the sns:Publish or <br> sqs:SendMessage action on this ARN, depending on which service is targeted." | `string` | `null` | no |
5556
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
5657
| <a name="input_description"></a> [description](#input\_description) | Description of what the Lambda Function does. | `string` | `null` | no |
5758
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |

main.tf

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ resource "aws_lambda_function" "this" {
3434
tags = var.tags
3535
timeout = var.timeout
3636

37+
dynamic "dead_letter_config" {
38+
for_each = try(length(var.dead_letter_config_target_arn), 0) > 0 ? [true] : []
39+
40+
content {
41+
target_arn = var.dead_letter_config_target_arn
42+
}
43+
}
44+
3745
dynamic "environment" {
3846
for_each = var.lambda_environment != null ? [var.lambda_environment] : []
3947
content {

variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,13 @@ variable "custom_iam_policy_arns" {
245245
description = "ARNs of custom policies to be attached to the lambda role"
246246
default = []
247247
}
248+
249+
variable "dead_letter_config_target_arn" {
250+
type = string
251+
description = <<EOF
252+
ARN of an SNS topic or SQS queue to notify when an invocation fails. If this option is used, the function's IAM role
253+
must be granted suitable access to write to the target object, which means allowing either the sns:Publish or
254+
sqs:SendMessage action on this ARN, depending on which service is targeted."
255+
EOF
256+
default = null
257+
}

0 commit comments

Comments
 (0)