Skip to content

Commit

Permalink
fix: fix case when ommiting var.create_lifecycle_policy would break a…
Browse files Browse the repository at this point in the history
…pply phase
  • Loading branch information
ppastorf committed May 17, 2024
1 parent 9daab07 commit fc34473
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
locals {
create_private_repository = var.create && var.create_repository && var.repository_type == "private"
create_public_repository = var.create && var.create_repository && var.repository_type == "public"
create_lifecycle_policy = var.create_lifecycle_policy && var.repository_lifecycle_policy != ""
}

data "aws_caller_identity" "current" {}
Expand Down Expand Up @@ -211,7 +212,7 @@ resource "aws_ecr_repository_policy" "this" {
################################################################################

resource "aws_ecr_lifecycle_policy" "this" {
count = local.create_private_repository && var.create_lifecycle_policy ? 1 : 0
count = local.create_private_repository && local.create_lifecycle_policy ? 1 : 0

repository = aws_ecr_repository.this[0].name
policy = var.repository_lifecycle_policy
Expand Down

0 comments on commit fc34473

Please sign in to comment.