forked from appzen-oss/terraform-aws-account-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kms.tf
49 lines (37 loc) · 963 Bytes
/
kms.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
40
41
42
43
44
45
46
47
48
resource "aws_kms_key" "account" {
provider = "aws.member"
description = "${var.account_name} account key"
# tags = {}
}
# Aliases: account name, 'account'
resource "aws_kms_alias" "account" {
provider = "aws.member"
name = "alias/account"
target_key_id = "${aws_kms_key.account.key_id}"
}
resource "aws_kms_alias" "account_name" {
provider = "aws.member"
name = "alias/${var.account_name}"
target_key_id = "${aws_kms_key.account.key_id}"
}
/**
data "aws_kms_key" "account" {
provider = "aws.member"
key_id = "alias/account"
}
output "key_arn" {
value = "${data.aws_kms_key.account.arn}"
}
output "key_id" {
value = "${data.aws_kms_key.account.id}"
}
output "alias_arn" {
value = "${data.aws_kms_alias.account.arn}"
}
output "alias_key_arn" {
value = "${data.aws_kms_alias.account.target_key_arn}"
}
output "alias_key_id" {
value = "${data.aws_kms_alias.account.target_key_arn}"
}
/**/