Skip to content

Commit

Permalink
Move the cmk creation to outside of the module (#12)
Browse files Browse the repository at this point in the history
* Move the cmk creation to the outside of the module

* terraform-docs: automated update action

Co-authored-by: lzrocha <[email protected]>
  • Loading branch information
lzrocha and lzrocha authored Mar 3, 2022
1 parent 94726b0 commit db30da7
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 65 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The following resources will be created:

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

Expand Down
Empty file removed _outputs.tf
Empty file.
7 changes: 3 additions & 4 deletions _variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ variable "trust_accounts" {
description = "Accounts to trust and allow ECR fetch"
}

variable "ecr_cmk_encryption" {
type = bool
description = "Enabled KMS CMK encryption for ECR repository"
default = false
variable "kms_key_arn" {
type = string
description = "KMS Key ARN to use a CMK instead of default key"
}
4 changes: 1 addition & 3 deletions ecr-repositories.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ resource "aws_ecr_repository" "default" {

encryption_configuration {
encryption_type = "KMS"
kms_key = try(var.ecr_cmk_encryption, false) ? aws_kms_key.ecr[0].arn : null
kms_key = length(var.kms_key_arn) > 0 ? var.kms_key_arn : null
}

depends_on = [aws_kms_alias.ecr]
}
57 changes: 0 additions & 57 deletions kms.tf

This file was deleted.

0 comments on commit db30da7

Please sign in to comment.