This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathprivate_endpoint.tf
83 lines (73 loc) · 4.37 KB
/
private_endpoint.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
locals {
private_dns_zone_id = length(var.private_endpoint) > 0 ? try(azurerm_private_dns_zone.dns_zone[0].id, data.azurerm_private_dns_zone.dns_zone[0].id) : null
private_dns_zone_name = length(var.private_endpoint) > 0 ? try(azurerm_private_dns_zone.dns_zone[0].name, data.azurerm_private_dns_zone.dns_zone[0].name) : null
private_endpoint_links = length(var.private_endpoint) > 0 && var.private_dns_zone == null ? var.private_endpoint : {}
}
resource "azurerm_private_endpoint" "this" {
for_each = var.private_endpoint
location = each.value.location != null ? each.value.location : data.azurerm_resource_group.pe_vnet_rg[each.key].location
name = each.value.name
resource_group_name = data.azurerm_resource_group.pe_vnet_rg[each.key].name
subnet_id = data.azurerm_subnet.pe_subnet[each.key].id
tags = merge(local.tags, (/*<box>*/ (var.tracing_tags_enabled ? { for k, v in /*</box>*/ {
avm_git_commit = "71363fdf53bbd421fccb3db49a9900389d728e4a"
avm_git_file = "private_endpoint.tf"
avm_git_last_modified_at = "2024-06-27 07:37:22"
avm_git_org = "Azure"
avm_git_repo = "terraform-azurerm-openai"
avm_yor_trace = "030b9e99-e8f0-47e1-8865-7cea59a96f79"
} /*<box>*/ : replace(k, "avm_", var.tracing_tags_prefix) => v } : {}) /*</box>*/), (/*<box>*/ (var.tracing_tags_enabled ? { for k, v in /*</box>*/ {
avm_yor_name = "this"
} /*<box>*/ : replace(k, "avm_", var.tracing_tags_prefix) => v } : {}) /*</box>*/))
private_service_connection {
is_manual_connection = each.value.is_manual_connection
name = each.value.private_service_connection_name
private_connection_resource_id = azurerm_cognitive_account.this.id
subresource_names = var.pe_subresource
}
dynamic "private_dns_zone_group" {
for_each = each.value.private_dns_entry_enabled ? ["private_dns_zone_group"] : []
content {
name = local.private_dns_zone_name
private_dns_zone_ids = [local.private_dns_zone_id]
}
}
}
data "azurerm_private_dns_zone" "dns_zone" {
count = length(var.private_endpoint) > 0 && var.private_dns_zone != null ? 1 : 0
name = var.private_dns_zone.name
resource_group_name = var.private_dns_zone.resource_group_name
}
resource "azurerm_private_dns_zone" "dns_zone" {
count = length(var.private_endpoint) > 0 && var.private_dns_zone == null ? 1 : 0
name = "privatelink.openai.azure.com"
resource_group_name = data.azurerm_resource_group.this.name
tags = merge(local.tags, (/*<box>*/ (var.tracing_tags_enabled ? { for k, v in /*</box>*/ {
avm_git_commit = "0dfe2497a0421d4c7abd975088122ab600ce7c3d"
avm_git_file = "private_endpoint.tf"
avm_git_last_modified_at = "2023-05-09 12:30:19"
avm_git_org = "Azure"
avm_git_repo = "terraform-azurerm-openai"
avm_yor_trace = "bb987a75-abfb-4545-8256-689245e3a259"
} /*<box>*/ : replace(k, "avm_", var.tracing_tags_prefix) => v } : {}) /*</box>*/), (/*<box>*/ (var.tracing_tags_enabled ? { for k, v in /*</box>*/ {
avm_yor_name = "dns_zone"
} /*<box>*/ : replace(k, "avm_", var.tracing_tags_prefix) => v } : {}) /*</box>*/))
}
resource "azurerm_private_dns_zone_virtual_network_link" "dns_zone_link" {
for_each = local.private_endpoint_links
name = each.value.dns_zone_virtual_network_link_name
private_dns_zone_name = local.private_dns_zone_name
resource_group_name = data.azurerm_resource_group.this.name
virtual_network_id = data.azurerm_virtual_network.vnet[each.key].id
registration_enabled = false
tags = merge(local.tags, (/*<box>*/ (var.tracing_tags_enabled ? { for k, v in /*</box>*/ {
avm_git_commit = "c8b6b17b0b28a2aa54a3e734b9bd0a0d0ef5c267"
avm_git_file = "private_endpoint.tf"
avm_git_last_modified_at = "2023-05-04 10:08:08"
avm_git_org = "Azure"
avm_git_repo = "terraform-azurerm-openai"
avm_yor_trace = "56a10c97-703d-4492-84f3-f756053fb09c"
} /*<box>*/ : replace(k, "avm_", var.tracing_tags_prefix) => v } : {}) /*</box>*/), (/*<box>*/ (var.tracing_tags_enabled ? { for k, v in /*</box>*/ {
avm_yor_name = "dns_zone_link"
} /*<box>*/ : replace(k, "avm_", var.tracing_tags_prefix) => v } : {}) /*</box>*/))
}