From 33b4ee78fb8fadd5768a37ab41bc2cd5a3fefa5a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 29 Sep 2023 15:51:27 -0400 Subject: [PATCH 1/2] add terraform to remove images without tags --- terraform/stacks/ecr/stack.tf | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/terraform/stacks/ecr/stack.tf b/terraform/stacks/ecr/stack.tf index 465e26fe..cb775ac0 100644 --- a/terraform/stacks/ecr/stack.tf +++ b/terraform/stacks/ecr/stack.tf @@ -71,3 +71,29 @@ resource "aws_ecr_repository" "repository" { tags = {} tags_all = {} } + +resource "aws_ecr_lifecycle_policy" "ecr_repository_lifecycle_policy" { + for_each = var.repositories + + respository = each.key + + policy = < Date: Fri, 29 Sep 2023 15:59:33 -0400 Subject: [PATCH 2/2] fix typo --- terraform/stacks/ecr/stack.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/stacks/ecr/stack.tf b/terraform/stacks/ecr/stack.tf index cb775ac0..b03bc1e1 100644 --- a/terraform/stacks/ecr/stack.tf +++ b/terraform/stacks/ecr/stack.tf @@ -75,7 +75,7 @@ resource "aws_ecr_repository" "repository" { resource "aws_ecr_lifecycle_policy" "ecr_repository_lifecycle_policy" { for_each = var.repositories - respository = each.key + repository = each.key policy = <