diff --git a/README.md b/README.md index d730151..54cb958 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,10 @@ benefits of a lifecycle policy, all with just a few simple commands. Try it out | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| [encryption\_type](#input\_encryption\_type) | The encryption type to use for the repository. | `string` | `"AES256"` | no | | [force\_delete](#input\_force\_delete) | Delete the repository even if it contains images. | `bool` | `false` | no | | [image\_tag\_mutability](#input\_image\_tag\_mutability) | The tag mutability setting for the repository. | `string` | `"MUTABLE"` | no | +| [kms\_key](#input\_kms\_key) | The ARN of the KMS key to use for encryption. | `string` | `null` | no | | [lifecycle\_rules](#input\_lifecycle\_rules) | Lifecycle policy rules for expiring images. |
list(object({|
description = optional(string)
tag_status = optional(string)
tag_prefix_list = optional(list(string))
count_type = string
count_unit = optional(string)
count_number = number
}))
[| no | | [name](#input\_name) | Name of the ECR repository. | `string` | n/a | yes | | [policy](#input\_policy) | Repository policy document in JSON format. | `string` | `null` | no | @@ -80,16 +82,16 @@ benefits of a lifecycle policy, all with just a few simple commands. Try it out ## Resources -- resource.aws_ecr_lifecycle_policy.main (main.tf#38) +- resource.aws_ecr_lifecycle_policy.main (main.tf#43) - resource.aws_ecr_repository.main (main.tf#19) -- resource.aws_ecr_repository_policy.main (main.tf#31) -- data source.jq_query.main (main.tf#47) +- resource.aws_ecr_repository_policy.main (main.tf#36) +- data source.jq_query.main (main.tf#52) # Examples ### Full ```hcl module "basic_example" { - source = "../../" + source = "../.." name = var.name } diff --git a/examples/basic-example/main.tf b/examples/basic-example/main.tf index 580d95d..c341d0f 100644 --- a/examples/basic-example/main.tf +++ b/examples/basic-example/main.tf @@ -1,5 +1,5 @@ module "basic_example" { - source = "../../" + source = "../.." name = var.name } diff --git a/main.tf b/main.tf index 3fa002a..4606840 100644 --- a/main.tf +++ b/main.tf @@ -21,6 +21,11 @@ resource "aws_ecr_repository" "main" { image_tag_mutability = var.image_tag_mutability force_delete = var.force_delete + encryption_configuration { + encryption_type = var.encryption_type + kms_key = var.kms_key + } + image_scanning_configuration { scan_on_push = var.scan_on_push } diff --git a/variables.tf b/variables.tf index 578121c..e8c62d0 100644 --- a/variables.tf +++ b/variables.tf @@ -11,26 +11,26 @@ variable "tags" { } ## REPOSITORY +variable "encryption_type" { + description = "The encryption type to use for the repository." + default = "AES256" + type = string +} + variable "image_tag_mutability" { description = "The tag mutability setting for the repository." default = "MUTABLE" type = string } -variable "scan_on_push" { - description = "Indicates whether images are scanned after being pushed to the repository." - default = true - type = bool -} - variable "force_delete" { description = "Delete the repository even if it contains images." default = false type = bool } -variable "policy" { - description = "Repository policy document in JSON format." +variable "kms_key" { + description = "The ARN of the KMS key to use for encryption." default = null type = string } @@ -62,3 +62,15 @@ variable "lifecycle_rules" { count_number = number })) } + +variable "policy" { + description = "Repository policy document in JSON format." + default = null + type = string +} + +variable "scan_on_push" { + description = "Indicates whether images are scanned after being pushed to the repository." + default = true + type = bool +}
{
"count_number": 30,
"count_type": "imageCountMoreThan",
"description": "Keep the last 30 tagged images",
"tag_prefix_list": [
"sha"
],
"tag_status": "tagged"
},
{
"count_number": 10,
"count_type": "sinceImagePushed",
"count_unit": "days",
"description": "Expire untagged images older than 10 days",
"tag_status": "untagged"
}
]