Skip to content

Commit 01c4697

Browse files
authored
feat: Support image_tag_mutability_exclusion_filter for aws_ecr_repository_creation_template (#62)
support tag mutability exclusion filter
1 parent 9795344 commit 01c4697

File tree

14 files changed

+77
-42
lines changed

14 files changed

+77
-42
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
195195
| Name | Version |
196196
|------|---------|
197197
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
198-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.8 |
198+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.10 |
199199

200200
## Providers
201201

202202
| Name | Version |
203203
|------|---------|
204-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.8 |
204+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.10 |
205205

206206
## Modules
207207

examples/complete/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ Note that this example may create resources which will incur monetary charges on
2828
| Name | Version |
2929
|------|---------|
3030
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
31-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.8 |
31+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.10 |
3232

3333
## Providers
3434

3535
| Name | Version |
3636
|------|---------|
37-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.8 |
37+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.10 |
3838

3939
## Modules
4040

examples/complete/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 6.8"
7+
version = ">= 6.10"
88
}
99
}
1010
}

examples/repository-template/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ If you validate the example by using the pull-through cache, you will need to ma
2222
| Name | Version |
2323
|------|---------|
2424
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
25-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.8 |
25+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.10 |
2626

2727
## Providers
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.8 |
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.10 |
3232

3333
## Modules
3434

examples/repository-template/main.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ module "public_ecr_pull_through_cache_repository_template" {
5050
create_pull_through_cache_rule = true
5151
upstream_registry_url = "public.ecr.aws"
5252

53+
image_tag_mutability = "MUTABLE_WITH_EXCLUSION"
54+
image_tag_mutability_exclusion_filter = [
55+
{
56+
filter = "latest*"
57+
filter_type = "WILDCARD"
58+
},
59+
{
60+
filter = "dev-*"
61+
filter_type = "WILDCARD"
62+
},
63+
{
64+
filter = "qa-*"
65+
filter_type = "WILDCARD"
66+
}
67+
]
68+
5369
tags = local.tags
5470
}
5571

examples/repository-template/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 6.8"
7+
version = ">= 6.10"
88
}
99
}
1010
}

modules/repository-template/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
9898
| Name | Version |
9999
|------|---------|
100100
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
101-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.8 |
101+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.10 |
102102

103103
## Providers
104104

105105
| Name | Version |
106106
|------|---------|
107-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.8 |
107+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.10 |
108108

109109
## Modules
110110

@@ -145,6 +145,7 @@ No modules.
145145
| <a name="input_iam_role_tags"></a> [iam\_role\_tags](#input\_iam\_role\_tags) | A map of additional tags to add to the IAM role created | `map(string)` | `{}` | no |
146146
| <a name="input_iam_role_use_name_prefix"></a> [iam\_role\_use\_name\_prefix](#input\_iam\_role\_use\_name\_prefix) | Determines whether the IAM role name (`iam_role_name`) is used as a prefix | `bool` | `true` | no |
147147
| <a name="input_image_tag_mutability"></a> [image\_tag\_mutability](#input\_image\_tag\_mutability) | The tag mutability setting for any created repositories. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `IMMUTABLE` | `string` | `"IMMUTABLE"` | no |
148+
| <a name="input_image_tag_mutability_exclusion_filter"></a> [image\_tag\_mutability\_exclusion\_filter](#input\_image\_tag\_mutability\_exclusion\_filter) | Configuration block that defines filters to specify which image tags can override the default tag mutability setting. Only applicable when image\_tag\_mutability is set to IMMUTABLE\_WITH\_EXCLUSION or MUTABLE\_WITH\_EXCLUSION. | <pre>list(object({<br/> filter = string<br/> filter_type = string<br/> }))</pre> | `null` | no |
148149
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN of the KMS key used to encrypt the repositories created | `string` | `null` | no |
149150
| <a name="input_lifecycle_policy"></a> [lifecycle\_policy](#input\_lifecycle\_policy) | The lifecycle policy document to apply to any created repositories | `string` | `null` | no |
150151
| <a name="input_prefix"></a> [prefix](#input\_prefix) | (Required) The repository name prefix to match against. Use `ROOT` to match any prefix that doesn't explicitly match another template | `string` | `""` | no |

modules/repository-template/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ resource "aws_ecr_repository_creation_template" "this" {
3030
}
3131
}
3232

33+
dynamic "image_tag_mutability_exclusion_filter" {
34+
for_each = var.image_tag_mutability_exclusion_filter != null ? var.image_tag_mutability_exclusion_filter : []
35+
content {
36+
filter = image_tag_mutability_exclusion_filter.value.filter
37+
filter_type = image_tag_mutability_exclusion_filter.value.filter_type
38+
}
39+
}
40+
3341
image_tag_mutability = var.image_tag_mutability
3442
lifecycle_policy = var.lifecycle_policy
3543
prefix = var.prefix

modules/repository-template/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ variable "kms_key_arn" {
5050
default = null
5151
}
5252

53+
variable "image_tag_mutability_exclusion_filter" {
54+
description = "Configuration block that defines filters to specify which image tags can override the default tag mutability setting. Only applicable when image_tag_mutability is set to IMMUTABLE_WITH_EXCLUSION or MUTABLE_WITH_EXCLUSION."
55+
type = list(object({
56+
filter = string
57+
filter_type = string
58+
}))
59+
default = null
60+
}
61+
5362
variable "image_tag_mutability" {
5463
description = "The tag mutability setting for any created repositories. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `IMMUTABLE`"
5564
type = string

modules/repository-template/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 6.8"
7+
version = ">= 6.10"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)