Skip to content

Commit c23a560

Browse files
committed
fix(lambda_update): ignore image_uri based on a var
1 parent dedc736 commit c23a560

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ resource "aws_lambda_function" "this" {
4343
replacement_security_group_ids = var.replacement_security_group_ids
4444
skip_destroy = var.skip_destroy
4545

46+
/* ignore image_uri when var.ignore_image_uri is true */
47+
dynamic "lifecycle" {
48+
for_each = var.ignore_image_uri ? [1] : []
49+
50+
content {
51+
ignore_changes = [
52+
image_uri,
53+
]
54+
}
55+
}
56+
4657
/* ephemeral_storage is not supported in gov-cloud region, so it should be set to `null` */
4758
dynamic "ephemeral_storage" {
4859
for_each = var.ephemeral_storage_size == null ? [] : [true]

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ variable "image_uri" {
224224
default = null
225225
}
226226

227+
variable "ignore_image_uri" {
228+
description = "Whether to ignore changes to the function's image URI. Set to true if you manage infrastructure and code deployments separately."
229+
type = bool
230+
default = false
231+
}
232+
227233
variable "image_config_entry_point" {
228234
description = "The ENTRYPOINT for the docker image"
229235
type = list(string)

0 commit comments

Comments
 (0)