Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
refactors KMS module (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleGedd authored Nov 3, 2022
1 parent dd4a302 commit 667dc4b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
17 changes: 8 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
# AWS Key Management Service
################################################################################
resource "aws_kms_key" "this" {
description = var.description
deletion_window_in_days = var.deletion_window_in_days
key_usage = var.key_usage
description = var.description
deletion_window_in_days = var.deletion_window_in_days
key_usage = var.key_usage
customer_master_key_spec = var.customer_master_key_spec
is_enabled = var.is_enabled
enable_key_rotation = var.enable_key_rotation
multi_region = var.multi_region
tags = {
is_enabled = var.is_enabled
enable_key_rotation = var.enable_key_rotation
multi_region = var.multi_region
tags = {
Name = var.name
}
}

resource "aws_kms_alias" "this" {
name = "alias/batcave-landing-sops"
name = var.alias
target_key_id = aws_kms_key.this.key_id
}

4 changes: 2 additions & 2 deletions output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ output "key_id" {
value = aws_kms_key.this.key_id
}

output "tags" {
value = aws_kms_key.this.tags_all
output "alias" {
value = aws_kms_alias.this.name
}
4 changes: 4 additions & 0 deletions vairables.tf → variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ variable "enable_key_rotation" {
variable "multi_region" {
default = "false"
}

variable "alias" {
default = "alias/batcave-landing-sops"
}

0 comments on commit 667dc4b

Please sign in to comment.