Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Allow multiple scan filters per scan type in registry; Raise MSV of Terraform and AWS provider to 1.0 and 5.0 respectively #29

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.0
rev: v1.88.2
hooks:
- id: terraform_fmt
- id: terraform_wrapper_module_for_each
Expand Down
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,23 @@ module "ecr_registry" {
registry_scan_rules = [
{
scan_frequency = "SCAN_ON_PUSH"
filter = "*"
filter_type = "WILDCARD"
}, {
filter = [
{
filter = "example1"
filter_type = "WILDCARD"
},
{ filter = "example2"
filter_type = "WILDCARD"
}
]
}, {
scan_frequency = "CONTINUOUS_SCAN"
filter = "example"
filter_type = "WILDCARD"
filter = [
{
filter = "example"
filter_type = "WILDCARD"
}
]
}
]

Expand Down Expand Up @@ -181,14 +192,14 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.22 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.22 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0 |

## Modules

Expand Down
6 changes: 3 additions & 3 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ Note that this example may create resources which will incur monetary charges on

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.22 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.22 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0 |

## Modules

Expand Down
19 changes: 15 additions & 4 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,23 @@ module "ecr_registry" {
registry_scan_rules = [
{
scan_frequency = "SCAN_ON_PUSH"
filter = "*"
filter_type = "WILDCARD"
filter = [
{
filter = "example1"
filter_type = "WILDCARD"
},
{ filter = "example2"
filter_type = "WILDCARD"
}
]
}, {
scan_frequency = "CONTINUOUS_SCAN"
filter = "example"
filter_type = "WILDCARD"
filter = [
{
filter = "example"
filter_type = "WILDCARD"
}
]
}
]

Expand Down
4 changes: 2 additions & 2 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.22"
version = ">= 5.0"
}
}
}
10 changes: 7 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,13 @@ resource "aws_ecr_registry_scanning_configuration" "this" {
content {
scan_frequency = rule.value.scan_frequency

repository_filter {
filter = rule.value.filter
filter_type = try(rule.value.filter_type, "WILDCARD")
dynamic "repository_filter" {
for_each = rule.value.filter

content {
filter = repository_filter.value.filter
filter_type = try(repository_filter.value.filter_type, "WILDCARD")
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.22"
version = ">= 5.0"
}
}
}