-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
39 lines (35 loc) · 1.47 KB
/
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
33
34
35
36
37
38
39
## Managed By : DevOps4Me
# Description : This Script is used to create Cloudfront CDN on AWS.
## Copyright @ DevOps4Me. All Right Reserved.
#Module : label
#Description : This terraform module is designed to generate consistent label names and tags
# for resources. You can use terraform-labels to implement a strict naming
# convention.
module "labels" {
source = "git::https://gitlab.com/devops4me-automation/terraform-label.git"
name = var.name
application = var.application
environment = var.environment
managedby = var.managedby
label_order = var.label_order
}
# Module : KMS KEY
# Description : This terraform module creates a KMS Customer Master Key (CMK) and its alias.
resource "aws_kms_key" "default" {
count = var.enabled ? 1 : 0
description = var.description
key_usage = var.key_usage
deletion_window_in_days = var.deletion_window_in_days
is_enabled = var.is_enabled
enable_key_rotation = var.enable_key_rotation
customer_master_key_spec = var.customer_master_key_spec
policy = var.policy
tags = module.labels.tags
}
# Module : KMS ALIAS
# Description : Provides an alias for a KMS customer master key..
resource "aws_kms_alias" "default" {
count = var.enabled ? 1 : 0
name = coalesce(var.alias, format("alias/%v", module.labels.id))
target_key_id = join("", aws_kms_key.default.*.id)
}