From 5f8c61c75bbd949509b7cbfa0868a97595186939 Mon Sep 17 00:00:00 2001 From: John Robison Date: Thu, 10 Feb 2022 16:10:54 -0500 Subject: [PATCH 1/2] feat: add limit_num_imgs variable --- README.md | 1 + main.tf | 5 +++-- variables.tf | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e18f17a..dc962d1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ A Terraform Module to integrate Amazon Container Registries (ECR) with Lacework. | `limit_by_tags` |A list of image tags to limit the assessment of images with matching tags. If you specify limit_by_tags and limit_by_labels limits, they function as an AND. Supported field input can be ["mytext\*mytext", "mytext", "mytext\*", "mytext". Only one * wildcard is supported.| `list(string)` | no | | `limit_by_labels` |A list of image labels to limit the assessment of images with matching labels. If you specify limit_by_tags and limit_by_labels limits, they function as an AND. Supported field input can be ["mytext\*mytext", "mytext", "mytext*", "mytext"].Only one * wildcard is supported.| `list(string)` | no | | `limit_by_repositories` |A list of repositories to assess.| `list(string)` | no | +| `limit_num_imgs` |The maximum number of newest container images to assess per repository. Must be one of 5, 10, or 15. Defaults to 5.| `number` | 5 | no | ## Outputs diff --git a/main.tf b/main.tf index 8d0f608..2074b30 100644 --- a/main.tf +++ b/main.tf @@ -41,8 +41,9 @@ resource "lacework_integration_ecr" "iam_role" { role_arn = local.iam_role_arn external_id = local.iam_role_external_id } - limit_by_tags = var.limit_by_tags - limit_by_labels = var.limit_by_labels + limit_by_tags = var.limit_by_tags + limit_by_labels = var.limit_by_labels limit_by_repositories = var.limit_by_repositories + limit_num_imgs = var.limit_num_imgs depends_on = [time_sleep.wait_time] } diff --git a/variables.tf b/variables.tf index 0dfd9f8..800fda0 100644 --- a/variables.tf +++ b/variables.tf @@ -46,6 +46,17 @@ variable "limit_by_repositories" { description = "A list of repositories to assess" } +variable "limit_num_imgs" { + type = number + default = 5 + description = "The maximum number of newest container images to assess per repository. Must be one of 5, 10, or 15. Defaults to 5." + + validation { + condition = contains([5, 10, 15], var.limit_num_imgs) + error_message = "The limit_num_imgs variable must be one of 5, 10, or 15." + } +} + variable "external_id_length" { type = number default = 16 From 42966ccc9e9486fc2c069eb5e4c4306b1135bfd2 Mon Sep 17 00:00:00 2001 From: John Robison Date: Mon, 21 Feb 2022 09:34:22 -0500 Subject: [PATCH 2/2] [ADD-LIMIT] remove validation --- variables.tf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/variables.tf b/variables.tf index 800fda0..4770afa 100644 --- a/variables.tf +++ b/variables.tf @@ -50,11 +50,6 @@ variable "limit_num_imgs" { type = number default = 5 description = "The maximum number of newest container images to assess per repository. Must be one of 5, 10, or 15. Defaults to 5." - - validation { - condition = contains([5, 10, 15], var.limit_num_imgs) - error_message = "The limit_num_imgs variable must be one of 5, 10, or 15." - } } variable "external_id_length" {