-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
132 lines (128 loc) · 5.38 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
module "ses-global" {
source = "genstackio/ses/aws//modules/global"
version = "0.3.4"
domain = var.dns
zone = var.zone
}
module "ses-global-domains" {
for_each = { for k,v in var.domains: k => v if null != lookup(v, "zone", null) }
source = "genstackio/ses/aws//modules/global"
version = "0.3.4"
domain = lookup(each.value, "dns", each.key)
zone = lookup(each.value, "zone", null)
}
module "ses-regional-identity" {
source = "genstackio/ses/aws//modules/regional-identity"
version = "0.3.4"
name = "${var.env}-${replace(var.dns, ".", "-")}"
sources = var.sources
service_sources = var.service_sources
domain = var.dns
emails = var.identities
}
module "ses-regional-identity-domains" {
for_each = { for k,v in var.domains: k => v if true == lookup(v, "regional", true) }
source = "genstackio/ses/aws//modules/regional-identity"
version = "0.3.4"
name = lookup(each.value, "name", "${var.env}-${replace(lookup(each.value, "dns", each.key), ".", "-")}")
sources = lookup(each.value, "sources", [])
service_sources = lookup(each.value, "service_sources", [])
domain = lookup(each.value, "dns", each.key)
emails = lookup(each.value, "identities", {})
}
module "ses-regional-identity-shared" {
source = "genstackio/ses/aws//modules/regional-identity"
version = "0.3.4"
name = "${var.env}-${replace(var.dns, ".", "-")}"
sources = var.sources
service_sources = var.service_sources
domain = var.dns
emails = var.identities
providers = {
aws = aws.shared
}
}
module "ses-regional-identity-shared-domains" {
for_each = { for k,v in var.domains: k => v if true == lookup(v, "shared", true) }
source = "genstackio/ses/aws//modules/regional-identity"
version = "0.3.4"
name = lookup(each.value, "name", "${var.env}-${replace(lookup(each.value, "dns", each.key), ".", "-")}")
sources = lookup(each.value, "sources", [])
service_sources = lookup(each.value, "service_sources", [])
domain = lookup(each.value, "dns", each.key)
emails = lookup(each.value, "identities", {})
providers = {
aws = aws.shared
}
}
module "ses-global-verification" {
source = "genstackio/ses/aws//modules/global-verification"
version = "0.3.4"
domain = var.dns
zone = var.zone
identities = local.identities
}
module "ses-global-verification-domains" {
for_each = { for k,v in var.domains: k => v if null != lookup(v, "zone", null) }
source = "genstackio/ses/aws//modules/global-verification"
version = "0.3.4"
domain = lookup(each.value, "dns", each.key)
zone = lookup(each.value, "zone", null)
identities = local.identities_domains[each.key]
}
module "ses-regional-verification" {
source = "genstackio/ses/aws//modules/regional-verification"
version = "0.3.4"
id = module.ses-regional-identity.id
depends_on = [module.ses-global-verification]
}
module "ses-regional-verification-domains" {
for_each = { for k,v in var.domains: k => v if true == lookup(v, "regional", true) }
source = "genstackio/ses/aws//modules/regional-verification"
version = "0.3.4"
id = module.ses-regional-identity-domains[each.key].id
depends_on = [module.ses-global-verification-domains]
}
module "ses-regional-verification-shared" {
source = "genstackio/ses/aws//modules/regional-verification"
version = "0.3.4"
id = module.ses-regional-identity-shared.id
providers = {
aws = aws.shared
}
depends_on = [module.ses-global-verification]
}
module "ses-regional-verification-shared-domains" {
for_each = { for k,v in var.domains: k => v if true == lookup(v, "shared", true) }
source = "genstackio/ses/aws//modules/regional-verification"
version = "0.3.4"
id = module.ses-regional-identity-shared-domains[each.key].id
providers = {
aws = aws.shared
}
depends_on = [module.ses-global-verification-domains]
}
module "pinpoint-app" {
source = "genstackio/pinpoint/aws"
version = "0.3.0"
name = "${var.env}-${replace(var.dns, ".", "-")}"
email = null != var.pinpoint_channels.email ? {from = "${var.identities[var.pinpoint_channels.email.identity]}@${var.dns}", identity = module.ses-regional-identity-shared.arn} : null
sms = null != var.pinpoint_channels.sms ? {} : null
providers = {
aws = aws.shared
}
}
module "pinpoint-app-domains" {
for_each = { for k,v in var.domains: k => v if null != lookup(v, "pinpoint_channels", null) && true == lookup(v, "shared", true) }
source = "genstackio/pinpoint/aws"
version = "0.3.0"
name = lookup(each.value, "name", "${var.env}-${replace(lookup(each.value, "dns", each.key), ".", "-")}")
email = null != lookup(lookup(each.value, "pinpoint_channels", {email = null}), "email", null) ? {
from = format("%s@%s", lookup(lookup(each.value, "identities", {}), lookup(lookup(lookup(each.value, "pinpoint_channels", {email = null}), "email", null), "identity", {}), ""), lookup(each.value, "dns", null)),
identity = module.ses-regional-identity-shared-domains[each.key].arn
} : null
sms = null != lookup(lookup(each.value, "pinpoint_channels", {sms = null}), "sms", null) ? {} : null
providers = {
aws = aws.shared
}
}