Skip to content

Commit

Permalink
feat: Add ignore_source_code_hash variable and pass to lambda module
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgch committed Dec 14, 2023
1 parent 96153e3 commit 96afe28
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ See the [functions](https://github.com/terraform-aws-modules/terraform-aws-notif
| <a name="input_iam_role_name_prefix"></a> [iam\_role\_name\_prefix](#input\_iam\_role\_name\_prefix) | A unique role name beginning with the specified prefix | `string` | `"lambda"` | no |
| <a name="input_iam_role_path"></a> [iam\_role\_path](#input\_iam\_role\_path) | Path of IAM role to use for Lambda Function | `string` | `null` | no |
| <a name="input_iam_role_tags"></a> [iam\_role\_tags](#input\_iam\_role\_tags) | Additional tags for the IAM role | `map(string)` | `{}` | no |
| <a name="input_ignore_source_code_hash"></a> [ignore\_source\_code\_hash](#input\_ignore\_source\_code\_hash) | Whether to ignore changes to the function's source code hash. Set to true if you manage infrastructure and code deployments separately. | `bool` | `false` | no |
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | ARN of the KMS key used for decrypting slack webhook url | `string` | `""` | no |
| <a name="input_lambda_attach_dead_letter_policy"></a> [lambda\_attach\_dead\_letter\_policy](#input\_lambda\_attach\_dead\_letter\_policy) | Controls whether SNS/SQS dead letter notification policy should be added to IAM role for Lambda Function | `bool` | `false` | no |
| <a name="input_lambda_dead_letter_target_arn"></a> [lambda\_dead\_letter\_target\_arn](#input\_lambda\_dead\_letter\_target\_arn) | The ARN of an SNS topic or SQS queue to notify when an invocation fails. | `string` | `null` | no |
Expand Down
11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,16 @@ module "lambda" {
function_name = var.lambda_function_name
description = var.lambda_description

hash_extra = var.hash_extra
ephemeral_storage_size = var.lambda_function_ephemeral_storage_size
handler = "${local.lambda_handler}.lambda_handler"
source_path = var.lambda_source_path != null ? "${path.root}/${var.lambda_source_path}" : "${path.module}/functions/notify_slack.py"
hash_extra = var.hash_extra
ignore_source_code_hash = var.ignore_source_code_hash
kms_key_arn = var.kms_key_arn
recreate_missing_package = var.recreate_missing_package
reserved_concurrent_executions = var.reserved_concurrent_executions
runtime = "python3.8"
source_path = var.lambda_source_path != null ? "${path.root}/${var.lambda_source_path}" : "${path.module}/functions/notify_slack.py"
timeout = 30
kms_key_arn = var.kms_key_arn
reserved_concurrent_executions = var.reserved_concurrent_executions
ephemeral_storage_size = var.lambda_function_ephemeral_storage_size

# If publish is disabled, there will be "Error adding new Lambda Permission for notify_slack:
# InvalidParameterValueException: We currently do not support adding policies for $LATEST."
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ variable "hash_extra" {
default = ""
}

variable "ignore_source_code_hash" {
description = "Whether to ignore changes to the function's source code hash. Set to true if you manage infrastructure and code deployments separately."
type = bool
default = false
}

variable "lambda_role" {
description = "IAM role attached to the Lambda Function. If this is set then a role will not be created for you."
type = string
Expand Down

0 comments on commit 96afe28

Please sign in to comment.