Skip to content

Commit

Permalink
Support immutability and scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
snemetz committed Nov 2, 2019
1 parent bfd8fe5 commit 7444fab
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
11 changes: 8 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ module "label" {
}

resource "aws_ecr_repository" "self" {
count = "${module.enabled.value}"
name = "${var.use_fullname == "true" ? module.label.id : module.label.name}"
tags = "${module.label.tags}"
count = "${module.enabled.value}"
name = "${var.use_fullname == "true" ? module.label.id : module.label.name}"
image_tag_mutability = "${var.image_tag_mutability}"
tags = "${module.label.tags}"

image_scanning_configuration {
scan_on_push = "${var.scan_on_push}"
}
}

resource "aws_ecr_lifecycle_policy" "aged" {
Expand Down
30 changes: 20 additions & 10 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
variable "accounts_ro" {
description = "AWS accounts to provide with readonly access to the ECR"
type = "list"
default = []
}

variable "accounts_rw" {
description = "AWS accounts to provide with full access to the ECR"
type = "list"
default = []
}

variable "enabled" {
description = "Set to false to prevent the module from creating any resources"
default = true
}

variable "image_tag_mutability" {
description = "The tag mutability setting for the repository. Must be one of: MUTABLE or IMMUTABLE. Defaults to MUTABLE"
default = "MUTABLE"
}

variable "max_image_age" {
description = "Max container image age"
default = "0"
Expand All @@ -19,16 +36,9 @@ variable "max_image_count" {
default = "500"
}

variable "accounts_rw" {
description = "AWS accounts to provide with full access to the ECR"
type = "list"
default = []
}

variable "accounts_ro" {
description = "AWS accounts to provide with readonly access to the ECR"
type = "list"
default = []
variable "scan_on_push" {
description = "Vulnerabiliy scan images automatically on push"
default = false
}

variable "use_fullname" {
Expand Down

0 comments on commit 7444fab

Please sign in to comment.