From 0472d649275df45dfd47514275e69792d1567d08 Mon Sep 17 00:00:00 2001 From: pcartas <82474601+pcartas@users.noreply.github.com> Date: Tue, 22 Nov 2022 19:35:18 -0300 Subject: [PATCH] adding force_delete (#101) * adding force_delete * Auto Format * Update variables.tf * Auto Format * Update example Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com> Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com> --- .github/auto-release.yml | 1 - .github/renovate.json | 2 +- .github/workflows/validate-codeowners.yml | 1 + README.md | 8 +++++--- docs/terraform.md | 5 +++-- examples/complete/versions.tf | 2 +- main.tf | 1 + variables.tf | 6 ++++++ versions.tf | 2 +- 9 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/auto-release.yml b/.github/auto-release.yml index b45efb7..17cd39c 100644 --- a/.github/auto-release.yml +++ b/.github/auto-release.yml @@ -17,7 +17,6 @@ version-resolver: - 'bugfix' - 'bug' - 'hotfix' - - 'no-release' default: 'minor' categories: diff --git a/.github/renovate.json b/.github/renovate.json index ae4f0aa..a780298 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -4,9 +4,9 @@ ":preserveSemverRanges" ], "labels": ["auto-update"], + "dependencyDashboardAutoclose": true, "enabledManagers": ["terraform"], "terraform": { "ignorePaths": ["**/context.tf", "examples/**"] } } - diff --git a/.github/workflows/validate-codeowners.yml b/.github/workflows/validate-codeowners.yml index 70f829e..4b4a226 100644 --- a/.github/workflows/validate-codeowners.yml +++ b/.github/workflows/validate-codeowners.yml @@ -10,6 +10,7 @@ jobs: steps: - name: "Checkout source code at current commit" uses: actions/checkout@v2 + # Leave pinned at 0.7.1 until https://github.com/mszostok/codeowners-validator/issues/173 is resolved - uses: mszostok/codeowners-validator@v0.7.1 if: github.event.pull_request.head.repo.full_name == github.repository name: "Full check of CODEOWNERS" diff --git a/README.md b/README.md index 1fa3f14..f81f0b2 100644 --- a/README.md +++ b/README.md @@ -154,13 +154,13 @@ Available targets: | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13.0 | -| [aws](#requirement\_aws) | >= 3.30.0 | +| [aws](#requirement\_aws) | >= 4.22.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 3.30.0 | +| [aws](#provider\_aws) | >= 4.22.0 | ## Modules @@ -194,6 +194,7 @@ Available targets: | [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | | [encryption\_configuration](#input\_encryption\_configuration) | ECR encryption configuration |
object({
encryption_type = string
kms_key = any
})
| `null` | no | | [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | +| [force\_delete](#input\_force\_delete) | Whether to delete the repository even if it contains images | `bool` | `false` | no | | [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no | | [image\_names](#input\_image\_names) | List of Docker local image names, used as repository names for AWS ECR | `list(string)` | `[]` | no | | [image\_tag\_mutability](#input\_image\_tag\_mutability) | The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE` | `string` | `"IMMUTABLE"` | no | @@ -390,7 +391,7 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply [![README Footer][readme_footer_img]][readme_footer_link] [![Beacon][beacon]][website] - + [logo]: https://cloudposse.com/logo-300x69.svg [docs]: https://cpco.io/docs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ecr&utm_content=docs [website]: https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-ecr&utm_content=website @@ -421,3 +422,4 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply [share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/terraform-aws-ecr [share_email]: mailto:?subject=terraform-aws-ecr&body=https://github.com/cloudposse/terraform-aws-ecr [beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-ecr?pixel&cs=github&cm=readme&an=terraform-aws-ecr + diff --git a/docs/terraform.md b/docs/terraform.md index 1b7f88d..6df3ad5 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -4,13 +4,13 @@ | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13.0 | -| [aws](#requirement\_aws) | >= 3.30.0 | +| [aws](#requirement\_aws) | >= 4.22.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 3.30.0 | +| [aws](#provider\_aws) | >= 4.22.0 | ## Modules @@ -44,6 +44,7 @@ | [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | | [encryption\_configuration](#input\_encryption\_configuration) | ECR encryption configuration |
object({
encryption_type = string
kms_key = any
})
| `null` | no | | [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | +| [force\_delete](#input\_force\_delete) | Whether to delete the repository even if it contains images | `bool` | `false` | no | | [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no | | [image\_names](#input\_image\_names) | List of Docker local image names, used as repository names for AWS ECR | `list(string)` | `[]` | no | | [image\_tag\_mutability](#input\_image\_tag\_mutability) | The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE` | `string` | `"IMMUTABLE"` | no | diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index 1bb665f..3a63759 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -3,7 +3,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 3.30.0" + version = ">= 4.22.0" } } } diff --git a/main.tf b/main.tf index 077c548..2fd8058 100755 --- a/main.tf +++ b/main.tf @@ -13,6 +13,7 @@ resource "aws_ecr_repository" "name" { for_each = toset(module.this.enabled ? local.image_names : []) name = each.value image_tag_mutability = var.image_tag_mutability + force_delete = var.force_delete dynamic "encryption_configuration" { for_each = var.encryption_configuration == null ? [] : [var.encryption_configuration] diff --git a/variables.tf b/variables.tf index 4287f47..f261eaa 100755 --- a/variables.tf +++ b/variables.tf @@ -66,3 +66,9 @@ variable "encryption_configuration" { description = "ECR encryption configuration" default = null } + +variable "force_delete" { + type = bool + description = "Whether to delete the repository even if it contains images" + default = false +} \ No newline at end of file diff --git a/versions.tf b/versions.tf index 0d41468..b8da404 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 3.30.0" + version = ">= 4.22.0" } } }