Skip to content

Commit

Permalink
feat: Support image tag mutability and scan settings (#517)
Browse files Browse the repository at this point in the history
* feat: Support image tag mutability and scan settings

* Renamed the vars.
  • Loading branch information
alexlokshin-czi authored Aug 28, 2023
1 parent 2684a0f commit 64e5e47
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions aws-ecr-repo/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ resource "aws_ecr_repository" "repo" {
name = var.name
tags = var.tags
force_delete = var.force_delete

image_tag_mutability = var.tag_mutability ? "MUTABLE" : "IMMUTABLE"

image_scanning_configuration {
scan_on_push = var.scan_on_push
}
lifecycle {
ignore_changes = [name]
}
Expand Down
12 changes: 12 additions & 0 deletions aws-ecr-repo/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,15 @@ variable "force_delete" {
description = "Allows this ECR repo to be automated deleted with terraform destroy. False by default"
default = false
}

variable "tag_mutability" {
type = bool
description = "Whether to allow tag mutability or not. When set to `true` tags can be overwritten (default). When set to `false` tags are immutable."
default = true
}

variable "scan_on_push" {
type = bool
description = "Whether to enable image scan on push, disabled by default."
default = false
}
2 changes: 1 addition & 1 deletion aws-ecr-repo/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.22.0"
version = ">= 5.14.0"
}
}
required_version = ">= 1.0"
Expand Down

0 comments on commit 64e5e47

Please sign in to comment.