Skip to content

Commit

Permalink
feat: keep the latest tag in ecr (#94)
Browse files Browse the repository at this point in the history
Signed-off-by: Bünyamin Dökmetaş <[email protected]>
  • Loading branch information
ztzxt authored Feb 28, 2024
1 parent 7f8d720 commit 45bdcd5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Terraform module which creates a ecs app
| <a name="input_log_driver"></a> [log\_driver](#input\_log\_driver) | The log driver to use for the container. If using Fargate launch type, only supported value is awslogs | `string` | `"awsfirelens"` | no |
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | The number of days to retain logs for the log group | `number` | `1` | no |
| <a name="input_log_router_container_cpu"></a> [log\_router\_container\_cpu](#input\_log\_router\_container\_cpu) | The log router cpu reservation for the ECS task definition | `string` | `30` | no |
| <a name="input_log_router_container_memory_reservation"></a> [log\_router\_container\_memory\_reservation](#input\_log\_router\_container\_memory\_reservation) | The log router cpu reservation for the ECS task definition | `string` | `64` | no |
| <a name="input_log_router_container_memory_reservation"></a> [log\_router\_container\_memory\_reservation](#input\_log\_router\_container\_memory\_reservation) | The log router memory reservation for the ECS task definition | `string` | `64` | no |
| <a name="input_log_router_image_repository"></a> [log\_router\_image\_repository](#input\_log\_router\_image\_repository) | Container registry repository url | `string` | n/a | yes |
| <a name="input_log_router_image_tag"></a> [log\_router\_image\_tag](#input\_log\_router\_image\_tag) | The default container image to use in container definition | `string` | `"stable-2.2.2"` | no |
| <a name="input_log_router_options"></a> [log\_router\_options](#input\_log\_router\_options) | The log router options to use | `map(string)` | <pre>{<br> "config-file-type": "file",<br> "config-file-value": "/fluent-bit/etc/extra.conf"<br>}</pre> | no |
Expand Down
15 changes: 14 additions & 1 deletion ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ module "ecr" {
rules = [
{
rulePriority = 1,
description = "Keep the latest tag",
selection = {
countNumber = 1
countType = "imageCountMoreThan"
tagStatus = "tagged"
tagPrefixList = ["latest"]
},
action = {
type = "expire"
}
},
{
rulePriority = 2,
description = "Remove untagged images",
selection = {
countNumber = 1
Expand All @@ -34,7 +47,7 @@ module "ecr" {
}
},
{
rulePriority = 2,
rulePriority = 3,
description = "Keep last 30 images",
selection = {
tagStatus = "any",
Expand Down
3 changes: 1 addition & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ variable "alarm_kinsumer" {
description = "This can be used to override alarms for kinsumers. Keys are names of the kinsumers."
}


variable "alarm_service_resources_enabled" {
type = bool
default = false
Expand Down Expand Up @@ -499,7 +498,7 @@ variable "log_router_container_cpu" {

variable "log_router_container_memory_reservation" {
type = string
description = "The log router cpu reservation for the ECS task definition"
description = "The log router memory reservation for the ECS task definition"
default = 64
}

Expand Down

0 comments on commit 45bdcd5

Please sign in to comment.