-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
42 lines (39 loc) · 1.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
resource "random_id" "name" {
byte_length = 8
}
resource "azurerm_email_communication_service" "this" {
name = var.email_service_name == "Default" ? random_id.name.hex : var.email_service_name
resource_group_name = data.azurerm_resource_group.rg.name
data_location = var.data_location
tags = var.tags
}
resource "azapi_resource" "managed_domain" {
type = "Microsoft.Communication/emailServices/domains@2023-03-31"
name = "AzureManagedDomain"
location = "global"
parent_id = azurerm_email_communication_service.this.id
body = jsonencode({
"properties" = {
"domainManagement" = "AzureManaged"
"userEngagementTracking" = "Disabled"
}
})
response_export_values = ["properties.mailFromSenderDomain"]
tags = var.tags
}
resource "azapi_resource" "communication_service" {
type = "Microsoft.Communication/communicationServices@2023-03-31"
name = var.communication_service_name == "Default" ? random_id.name.hex : var.communication_service_name
parent_id = data.azurerm_resource_group.rg.id
location = "global"
body = jsonencode({
"properties" = {
"dataLocation" = "${var.data_location}"
"linkedDomains" = [
"${azapi_resource.managed_domain.id}"
]
}
})
response_export_values = ["properties.hostName"]
tags = var.tags
}