Skip to content

Commit

Permalink
Merge pull request #22 from ministryofjustice/remove-ecr-lifecycle-po…
Browse files Browse the repository at this point in the history
…licy

Remove ECR lifecycle policy
  • Loading branch information
vijay-veeranki authored Jun 3, 2019
2 parents 90b59e1 + 318aa91 commit 52af8df
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2

terraform: &terraform
docker:
- image: hashicorp/terraform:light
- image: hashicorp/terraform:0.11.11
working_directory: /tmp/workspace/terraform

jobs:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Note: From version 3.0 of this module, The AWS region will default to eu-west-2
|------|-------------|:----:|:-----:|:-----:|
| repo_name | name of the repository to be created | string | - | yes |
| team_name | name of the team creating the credentials | string | - | yes |
| enable_policy | Sets a ECR lifecycle policy to delete every image after count 100 | string | true | yes
| aws_region | region into which the resource will be created | string | eu-west-2 | no
| providers | provider creating resources | arrays of string | default provider | no

Expand Down
2 changes: 1 addition & 1 deletion examples/ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/
module "example_team_ecr_credentials" {
source = "github.com/ministryofjustice/cloud-platform-terraform-ecr-credentials?ref=3.3"
source = "github.com/ministryofjustice/cloud-platform-terraform-ecr-credentials?ref=3.4"
repo_name = "example-module"
team_name = "example-team"

Expand Down
24 changes: 0 additions & 24 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,6 @@ resource "aws_ecr_repository" "repo" {
name = "${var.team_name}/${var.repo_name}"
}

resource "aws_ecr_lifecycle_policy" "lifecycle_policy" {
count = "${var.enable_policy ? 1 : 0}"
repository = "${aws_ecr_repository.repo.name}"

policy = <<EOF
{
"rules": [
{
"rulePriority": 2,
"description": "Expire images over count 100",
"selection": {
"tagStatus": "any",
"countType": "imageCountMoreThan",
"countNumber": 100
},
"action": {
"type": "expire"
}
}
]
}
EOF
}

resource "random_id" "user" {
byte_length = 8
}
Expand Down
5 changes: 0 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ variable "repo_name" {}

variable "team_name" {}

variable "enable_policy" {
description = "Sets a ECR lifecycle policy to delete every image after count 100. Default is true."
default = true
}

variable "aws_region" {
description = "Region into which the resource will be created."
default = "eu-west-2"
Expand Down

0 comments on commit 52af8df

Please sign in to comment.