Skip to content

Commit 850ddb0

Browse files
authored
feat: Add support for force_delete attribute (#9)
1 parent e9689e5 commit 850ddb0

File tree

9 files changed

+19
-7
lines changed

9 files changed

+19
-7
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.72.2
3+
rev: v1.74.1
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_wrapper_module_for_each

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
182182
| Name | Version |
183183
|------|---------|
184184
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
185-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0 |
185+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.22 |
186186

187187
## Providers
188188

189189
| Name | Version |
190190
|------|---------|
191-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0 |
191+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.22 |
192192

193193
## Modules
194194

@@ -230,6 +230,7 @@ No modules.
230230
| <a name="input_registry_scan_rules"></a> [registry\_scan\_rules](#input\_registry\_scan\_rules) | One or multiple blocks specifying scanning rules to determine which repository filters are used and at what frequency scanning will occur | `any` | `[]` | no |
231231
| <a name="input_registry_scan_type"></a> [registry\_scan\_type](#input\_registry\_scan\_type) | the scanning type to set for the registry. Can be either `ENHANCED` or `BASIC` | `string` | `"ENHANCED"` | no |
232232
| <a name="input_repository_encryption_type"></a> [repository\_encryption\_type](#input\_repository\_encryption\_type) | The encryption type for the repository. Must be one of: `KMS` or `AES256`. Defaults to `AES256` | `string` | `null` | no |
233+
| <a name="input_repository_force_delete"></a> [repository\_force\_delete](#input\_repository\_force\_delete) | If `true`, will delete the repository even if it contains images. Defaults to `false` | `bool` | `null` | no |
233234
| <a name="input_repository_image_scan_on_push"></a> [repository\_image\_scan\_on\_push](#input\_repository\_image\_scan\_on\_push) | Indicates whether images are scanned after being pushed to the repository (`true`) or not scanned (`false`) | `bool` | `true` | no |
234235
| <a name="input_repository_image_tag_mutability"></a> [repository\_image\_tag\_mutability](#input\_repository\_image\_tag\_mutability) | The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `IMMUTABLE` | `string` | `"IMMUTABLE"` | no |
235236
| <a name="input_repository_kms_key"></a> [repository\_kms\_key](#input\_repository\_kms\_key) | The ARN of the KMS key to use when encryption\_type is `KMS`. If not specified, uses the default AWS managed key for ECR | `string` | `null` | no |

examples/complete/README.md

+2-2
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) | >= 0.13.1 |
31-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0 |
31+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.22 |
3232

3333
## Providers
3434

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

3939
## Modules
4040

examples/complete/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ module "ecr" {
5151
]
5252
})
5353

54+
repository_force_delete = true
55+
5456
tags = local.tags
5557
}
5658

examples/complete/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 4.0"
7+
version = ">= 4.22"
88
}
99
}
1010
}

main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ resource "aws_ecr_repository" "this" {
118118
kms_key = var.repository_kms_key
119119
}
120120

121+
force_delete = var.repository_force_delete
122+
121123
image_scanning_configuration {
122124
scan_on_push = var.repository_image_scan_on_push
123125
}

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ variable "repository_policy" {
6262
default = null
6363
}
6464

65+
variable "repository_force_delete" {
66+
description = "If `true`, will delete the repository even if it contains images. Defaults to `false`"
67+
type = bool
68+
default = null
69+
}
70+
6571
################################################################################
6672
# Repository Policy
6773
################################################################################

versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 4.0"
7+
version = ">= 4.22"
88
}
99
}
1010
}

wrappers/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module "wrapper" {
1313
repository_kms_key = try(each.value.repository_kms_key, var.defaults.repository_kms_key, null)
1414
repository_image_scan_on_push = try(each.value.repository_image_scan_on_push, var.defaults.repository_image_scan_on_push, true)
1515
repository_policy = try(each.value.repository_policy, var.defaults.repository_policy, null)
16+
repository_force_delete = try(each.value.repository_force_delete, var.defaults.repository_force_delete, null)
1617
attach_repository_policy = try(each.value.attach_repository_policy, var.defaults.attach_repository_policy, true)
1718
create_repository_policy = try(each.value.create_repository_policy, var.defaults.create_repository_policy, true)
1819
repository_read_access_arns = try(each.value.repository_read_access_arns, var.defaults.repository_read_access_arns, [])

0 commit comments

Comments
 (0)