forked from cattle-ops/terraform-aws-gitlab-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkms.tf
22 lines (16 loc) · 693 Bytes
/
kms.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
resource "aws_kms_key" "default" {
count = var.enable_kms ? 1 : 0
description = "GitLab Runner module managed key - ${var.environment}"
deletion_window_in_days = var.kms_deletion_window_in_days > 0 ? var.kms_deletion_window_in_days : null
enable_key_rotation = var.kms_deletion_window_in_days > 0 ? true : false
tags = local.tags
policy = data.template_file.kms_policy[0].rendered
}
data "template_file" "kms_policy" {
count = var.enable_kms ? 1 : 0
template = file("${path.module}/policies/kms-policy.json")
vars = {
aws_region = var.aws_region
account_id = data.aws_caller_identity.current.account_id
}
}