generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 2
/
mon_topics.tf
212 lines (195 loc) · 8.85 KB
/
mon_topics.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# Copyright (c) 2023 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
locals {
#------------------------------------------------------------------------------------------------------
#-- Any of these local variables can be overriden in a _override.tf file
#------------------------------------------------------------------------------------------------------
# Tags
custom_topics_defined_tags = null
custom_topics_freeform_tags = null
}
module "lz_home_region_topics" {
count = var.extend_landing_zone_to_new_region == false ? 1 : 0
source = "github.com/oci-landing-zones/terraform-oci-modules-observability//notifications?ref=v0.1.8"
# depends_on = [ null_resource.wait_on_compartments ]
providers = { oci = oci.home }
notifications_configuration = local.home_region_notifications_configuration
}
module "lz_regional_topics" {
source = "github.com/oci-landing-zones/terraform-oci-modules-observability//notifications?ref=v0.1.8"
# depends_on = [ null_resource.wait_on_compartments ]
notifications_configuration = local.regional_notifications_configuration
}
locals {
#------------------------------------------------------------------------------------------------------
#-- These variables are not meant to be overriden
#------------------------------------------------------------------------------------------------------
#-----------------------------------------------------------
#----- Tags to apply to topics
#-----------------------------------------------------------
default_topics_defined_tags = null
default_topics_freeform_tags = local.landing_zone_tags
topics_defined_tags = local.custom_topics_defined_tags != null ? merge(local.custom_topics_defined_tags, local.default_topics_defined_tags) : local.default_topics_defined_tags
topics_freeform_tags = local.custom_topics_freeform_tags != null ? merge(local.custom_topics_freeform_tags, local.default_topics_freeform_tags) : local.default_topics_freeform_tags
#--------------------------------------------------------------------
#-- Security Topic
#--------------------------------------------------------------------
security_topic_key = "SECURITY-TOPIC"
security_topic = length(var.security_admin_email_endpoints) > 0 ? {
(local.security_topic_key) = {
compartment_id = local.security_compartment_id
name = "${var.service_label}-security-topic"
description = "Landing Zone topic for security related notifications."
defined_tags = local.topics_defined_tags
freeform_tags = local.topics_freeform_tags
subscriptions = [
{ protocol = "EMAIL"
values = var.security_admin_email_endpoints
}
]
}
} : {}
#--------------------------------------------------------------------
#-- Cloud Guard Topic
#--------------------------------------------------------------------
cloudguard_topic_key = "CLOUDGUARD-TOPIC"
cloudguard_topic = length(var.cloud_guard_admin_email_endpoints) > 0 ? {
(local.cloudguard_topic_key) = {
compartment_id = local.security_compartment_id
name = "${var.service_label}-cloudguard-topic"
description = "Landing Zone topic for Cloud Guard related notifications."
defined_tags = local.topics_defined_tags
freeform_tags = local.topics_freeform_tags
subscriptions = [
{ protocol = "EMAIL"
values = var.cloud_guard_admin_email_endpoints
}
]
}
} : {}
#--------------------------------------------------------------------
#-- Network Topic
#--------------------------------------------------------------------
network_topic_key = "NETWORK-TOPIC"
network_topic = length(var.network_admin_email_endpoints) > 0 ? {
(local.network_topic_key) = {
compartment_id = local.network_compartment_id
name = "${var.service_label}-network-topic"
description = "Landing Zone topic for network related notifications."
defined_tags = local.topics_defined_tags
freeform_tags = local.topics_freeform_tags
subscriptions = [
{ protocol = "EMAIL"
values = var.network_admin_email_endpoints
}
]
}
} : {}
#--------------------------------------------------------------------
#-- Compute Topic
#--------------------------------------------------------------------
compute_topic_key = "COMPUTE-TOPIC"
compute_topic = length(var.compute_admin_email_endpoints) > 0 ? {
(local.compute_topic_key) = {
compartment_id = local.app_compartment_id
name = "${var.service_label}-compute-topic"
description = "Landing Zone topic for compute performance related notifications."
defined_tags = local.topics_defined_tags
freeform_tags = local.topics_freeform_tags
subscriptions = [
{ protocol = "EMAIL"
values = var.compute_admin_email_endpoints
}
]
}
} : {}
#--------------------------------------------------------------------
#-- Database Topic
#--------------------------------------------------------------------
database_topic_key = "DATABASE-TOPIC"
database_topic = length(var.database_admin_email_endpoints) > 0 ? {
(local.database_topic_key) = {
compartment_id = local.database_compartment_id
name = "${var.service_label}-database-topic"
description = "Landing Zone topic for database performance related notifications."
defined_tags = local.topics_defined_tags
freeform_tags = local.topics_freeform_tags
subscriptions = [
{ protocol = "EMAIL"
values = var.database_admin_email_endpoints
}
]
}
} : {}
#--------------------------------------------------------------------
#-- Storage Topic
#--------------------------------------------------------------------
storage_topic_key = "STORAGE-TOPIC"
storage_topic = length(var.storage_admin_email_endpoints) > 0 ? {
(local.storage_topic_key) = {
compartment_id = local.app_compartment_id
name = "${var.service_label}-storage-topic"
description = "Landing Zone topic for storage performance related notifications."
defined_tags = local.topics_defined_tags
freeform_tags = local.topics_freeform_tags
subscriptions = [
{ protocol = "EMAIL"
values = var.storage_admin_email_endpoints
}
]
}
} : {}
#--------------------------------------------------------------------
#-- Budget Topic
#--------------------------------------------------------------------
budget_topic_key = "BUDGET-TOPIC"
budget_topic = length(var.budget_admin_email_endpoints) > 0 ? {
(local.budget_topic_key) = {
compartment_id = var.tenancy_ocid
name = "${var.service_label}-budget-topic"
description = "Landing Zone topic for budget related notifications."
defined_tags = local.topics_defined_tags
freeform_tags = local.topics_freeform_tags
subscriptions = [
{ protocol = "EMAIL"
values = var.budget_admin_email_endpoints
}
]
}
} : {}
#--------------------------------------------------------------------
#-- Exadata Topic
#--------------------------------------------------------------------
exainfra_topic_key = "EXAINFRA-TOPIC"
exainfra_topic = length(var.exainfra_admin_email_endpoints) > 0 && var.deploy_exainfra_cmp == true ? {
(local.exainfra_topic_key) = {
compartment_id = local.exainfra_compartment_id
name = "${var.service_label}-exainfra-topic"
description = "Landing Zone topic for Exadata infrastructure notifications."
defined_tags = local.topics_defined_tags
freeform_tags = local.topics_freeform_tags
subscriptions = [
{ protocol = "EMAIL"
values = var.exainfra_admin_email_endpoints
}
]
}
} : {}
#------------------------------------------------------------------------
#----- Notifications configuration definition. Input to module.
#------------------------------------------------------------------------
home_region_topics = merge(local.security_topic, local.cloudguard_topic)
regional_topics = merge(local.network_topic, local.compute_topic, local.database_topic, local.storage_topic, local.budget_topic, local.exainfra_topic)
home_region_notifications_configuration = {
default_compartment_id = null
default_defined_tags = local.default_topics_defined_tags
default_freeform_tags = local.default_topics_freeform_tags
topics = local.home_region_topics
}
regional_notifications_configuration = {
default_compartment_id = null
default_defined_tags = local.default_topics_defined_tags
default_freeform_tags = local.default_topics_freeform_tags
topics = local.regional_topics
}
}