-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.tf
32 lines (27 loc) · 1010 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module "kms_key" {
source = "cloudposse/kms-key/aws"
version = "0.12.1"
description = "Route53 DNSSEC customer managed CMK"
deletion_window_in_days = var.deletion_window_in_days
enable_key_rotation = false
key_usage = "SIGN_VERIFY"
customer_master_key_spec = "ECC_NIST_P256"
policy = data.aws_iam_policy_document.ksk.json
context = module.this.context
attributes = ["ksk"]
}
resource "random_string" "ksk" {
for_each = local.zones
keepers = {
hosted_zone_id = each.value.zone_id
key_management_service_arn = module.kms_key.key_arn
}
length = 32
special = false
}
resource "aws_route53_key_signing_key" "this" {
for_each = local.zones
hosted_zone_id = random_string.ksk[each.key].keepers.hosted_zone_id
key_management_service_arn = module.kms_key.key_arn
name = random_string.ksk[each.key].id
}