Skip to content

Commit db30da7

Browse files
authoredMar 3, 2022
Move the cmk creation to outside of the module (#12)
* Move the cmk creation to the outside of the module * terraform-docs: automated update action Co-authored-by: lzrocha <lzrocha@users.noreply.github.com>
1 parent 94726b0 commit db30da7

File tree

5 files changed

+5
-65
lines changed

5 files changed

+5
-65
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The following resources will be created:
3434

3535
| Name | Description | Type | Default | Required |
3636
|------|-------------|------|---------|:--------:|
37-
| ecr\_cmk\_encryption | Enabled KMS CMK encryption for ECR repository | `bool` | `false` | no |
37+
| kms\_key\_arn | KMS Key ARN to use a CMK instead of default key | `string` | n/a | yes |
3838
| name | Name for ECR repository | `any` | n/a | yes |
3939
| trust\_accounts | Accounts to trust and allow ECR fetch | `list(string)` | n/a | yes |
4040

‎_outputs.tf

Whitespace-only changes.

‎_variables.tf

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ variable "trust_accounts" {
77
description = "Accounts to trust and allow ECR fetch"
88
}
99

10-
variable "ecr_cmk_encryption" {
11-
type = bool
12-
description = "Enabled KMS CMK encryption for ECR repository"
13-
default = false
10+
variable "kms_key_arn" {
11+
type = string
12+
description = "KMS Key ARN to use a CMK instead of default key"
1413
}

‎ecr-repositories.tf

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ resource "aws_ecr_repository" "default" {
77

88
encryption_configuration {
99
encryption_type = "KMS"
10-
kms_key = try(var.ecr_cmk_encryption, false) ? aws_kms_key.ecr[0].arn : null
10+
kms_key = length(var.kms_key_arn) > 0 ? var.kms_key_arn : null
1111
}
12-
13-
depends_on = [aws_kms_alias.ecr]
1412
}

‎kms.tf

-57
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.