Skip to content

Commit

Permalink
Merge pull request #82 from ministryofjustice/ready-for-deletion
Browse files Browse the repository at this point in the history
Ready for deletion
  • Loading branch information
sj-williams authored Jun 28, 2023
2 parents 3ba043f + 4072a93 commit 7a86e2d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_deletion_protection"></a> [deletion\_protection](#input\_deletion\_protection) | (Optional) Whether the ECR should have deletion protection enabled for non-empty registry. Set this to false if you intend to delete your ECR resource or namespace. NOTE: PR owner has responsibility to ensure that no other environments are sharing this ECR. Defaults to true. | `bool` | `true` | no |
| <a name="input_github_actions_prefix"></a> [github\_actions\_prefix](#input\_github\_actions\_prefix) | String prefix for GitHub Actions variable and secrets key | `string` | `""` | no |
| <a name="input_github_actions_secret_ecr_access_key"></a> [github\_actions\_secret\_ecr\_access\_key](#input\_github\_actions\_secret\_ecr\_access\_key) | The name of the github actions secret containing the ECR AWS access key | `string` | `"ECR_AWS_ACCESS_KEY_ID"` | no |
| <a name="input_github_actions_secret_ecr_name"></a> [github\_actions\_secret\_ecr\_name](#input\_github\_actions\_secret\_ecr\_name) | The name of the github actions secret containing the ECR name | `string` | `"ECR_NAME"` | no |
Expand Down
7 changes: 7 additions & 0 deletions examples/ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,11 @@ module "ecr" {
}
EOF
*/

# OPTIONAL: Add deletion_protection = false parameter if you are planning on either deleting your environment namespace or ECR resource.
# IMPORTANT: It is the PR owners responsibility to ensure that no other environments are sharing this ECR registry.
# This flag will allow a non-empty ECR to be deleted.
# Defaults to true

# deletion_protection = false
}
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "aws_ecr_repository" "repo" {
image_scanning_configuration {
scan_on_push = var.scan_on_push
}
force_delete = var.deletion_protection ? false : true
}

# ECR lifecycle policy
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,9 @@ variable "github_actions_prefix" {
type = string
default = ""
}

variable "deletion_protection" {
description = "(Optional) Whether the ECR should have deletion protection enabled for non-empty registry. Set this to false if you intend to delete your ECR resource or namespace. NOTE: PR owner has responsibility to ensure that no other environments are sharing this ECR. Defaults to true."
type = bool
default = true
}

0 comments on commit 7a86e2d

Please sign in to comment.