-
Notifications
You must be signed in to change notification settings - Fork 0
/
key_vault.tf
53 lines (43 loc) · 1.87 KB
/
key_vault.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
# Key Vault with VNET binding and Private Endpoint
resource "azurerm_key_vault" "syn_kv" {
name = "${var.prefix}-kv-${random_string.postfix.result}"
location = azurerm_resource_group.syn_rg.location
resource_group_name = azurerm_resource_group.syn_rg.name
tenant_id = data.azurerm_client_config.current.tenant_id
sku_name = "standard"
network_acls {
default_action = "Deny"
ip_rules = []
virtual_network_subnet_ids = []
bypass = "None"
}
}
# DNS Zones
resource "azurerm_private_dns_zone" "kv_zone" {
name = "privatelink.vaultcore.azure.net"
resource_group_name = azurerm_resource_group.syn_rg.name
}
# Linking of DNS zones to Virtual Network
resource "azurerm_private_dns_zone_virtual_network_link" "kv_zone_link" {
name = "${random_string.postfix.result}_link_kv"
resource_group_name = azurerm_resource_group.syn_rg.name
private_dns_zone_name = azurerm_private_dns_zone.kv_zone.name
virtual_network_id = azurerm_virtual_network.syn_vnet.id
}
# Private Endpoint configuration
resource "azurerm_private_endpoint" "kv_pe" {
name = "${var.prefix}-kv-pe-${random_string.postfix.result}"
location = azurerm_resource_group.syn_rg.location
resource_group_name = azurerm_resource_group.syn_rg.name
subnet_id = azurerm_subnet.default_subnet.id
private_service_connection {
name = "${var.prefix}-kv-psc-${random_string.postfix.result}"
private_connection_resource_id = azurerm_key_vault.syn_kv.id
subresource_names = ["vault"]
is_manual_connection = false
}
private_dns_zone_group {
name = "private-dns-zone-group-kv"
private_dns_zone_ids = [azurerm_private_dns_zone.kv_zone.id]
}
}