Skip to content

Commit

Permalink
Refactor app/readme.md and terraform/ecr.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlahbib committed Nov 17, 2024
1 parent a790caf commit 956355f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Making changes to trigger an app update.

2
3
44 changes: 23 additions & 21 deletions terraform/ecr.tf
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
module "ecr" {
source = "terraform-aws-modules/ecr/aws"
create_repository = true
repository_name = var.repository_name
repository_lifecycle_policy = jsonencode({
resource "aws_ecr_repository" "ecr" {
name = var.repository_name
image_tag_mutability = "MUTABLE"

lifecycle {
prevent_destroy = true
}
}

resource "aws_ecr_lifecycle_policy" "ecr_policy" {
repository = aws_ecr_repository.ecr.name

policy = jsonencode({
rules = [
{
rulePriority = 1
description = "Keep last 30 images"
selection = {
tagStatus = "untagged"
countType = "imageCountMoreThan"
countNumber = 30
},
action = {
type = "expire"
}
rulePriority = 1
description = "Keep last 30 images"
selection = {
tagStatus = "untagged"
countType = "imageCountMoreThan"
countNumber = 30
}
action = {
type = "expire"
}
}
]
})

lifecycle {
prevent_destroy = true
}

repository_image_tag_mutability = "MUTABLE"
}
2 changes: 1 addition & 1 deletion terraform/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ output "cluster_name" {
}

output "repository_name" {
value = module.ecr.repository_name
value = aws_ecr_repository.ecr.repository_name
}

output "cluster_ip" {
Expand Down

0 comments on commit 956355f

Please sign in to comment.