Skip to content

Commit 8654c73

Browse files
add keyvault id (#25)
* DEVOPS-312 kv with private endpoint inside access * adding depends on conditions * remove pvt dns record resource * removed readme * terraform fmt and kv id
1 parent 75a7f07 commit 8654c73

File tree

4 files changed

+23
-103
lines changed

4 files changed

+23
-103
lines changed

keyvault-with-private-endpoint/README.md

Lines changed: 0 additions & 85 deletions
This file was deleted.

keyvault-with-private-endpoint/keyvault.tf

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ resource "azurerm_key_vault" "kv" {
2727

2828
public_network_access_enabled = var.public_network_access_enabled
2929

30-
depends_on = [ azurerm_resource_group.keyvault_rg ]
30+
depends_on = [azurerm_resource_group.keyvault_rg]
3131
network_acls {
32-
bypass = "AzureServices" # Specifies which traffic can bypass the network rules
33-
default_action = "Deny" # Specifies the default action when no rule from ip_rules and virtual_network_subnet_ids match
32+
bypass = "AzureServices" # Specifies which traffic can bypass the network rules
33+
default_action = "Deny" # Specifies the default action when no rule from ip_rules and virtual_network_subnet_ids match
3434
virtual_network_subnet_ids = [data.azurerm_subnet.pvt_end_pt.id] # List of subnet ids that can access the key vault
3535
}
3636

@@ -68,20 +68,20 @@ resource "azurerm_key_vault" "kv" {
6868

6969

7070
resource "azurerm_private_endpoint" "pvt_end_pt" {
71-
name = "${var.keyvault_name}-pvt-end-pt"
72-
location = azurerm_resource_group.keyvault_rg.location
73-
resource_group_name = azurerm_resource_group.keyvault_rg.name
74-
subnet_id = data.azurerm_subnet.pvt_end_pt.id
71+
name = "${var.keyvault_name}-pvt-end-pt"
72+
location = azurerm_resource_group.keyvault_rg.location
73+
resource_group_name = azurerm_resource_group.keyvault_rg.name
74+
subnet_id = data.azurerm_subnet.pvt_end_pt.id
7575
custom_network_interface_name = "${var.keyvault_name}-pvt-end-pt-nic"
76-
77-
depends_on = [ azurerm_key_vault.kv, azurerm_resource_group.keyvault_rg ]
76+
77+
depends_on = [azurerm_key_vault.kv, azurerm_resource_group.keyvault_rg]
7878

7979
private_service_connection {
80-
name = lower("${azurerm_key_vault.kv.name}-psc")
81-
private_connection_resource_id = azurerm_key_vault.kv.id
82-
is_manual_connection = false
83-
subresource_names = ["Vault"]
84-
}
80+
name = lower("${azurerm_key_vault.kv.name}-psc")
81+
private_connection_resource_id = azurerm_key_vault.kv.id
82+
is_manual_connection = false
83+
subresource_names = ["Vault"]
84+
}
8585

8686
private_dns_zone_group {
8787
name = "privatelink.vaultcore.azure.net"

keyvault-with-private-endpoint/output.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ output "keyvault_name" {
88
value = azurerm_key_vault.kv.name
99
}
1010

11+
output "keyvault_id" {
12+
description = "value of keyvault id"
13+
value = azurerm_key_vault.kv.id
14+
}
15+
1116
output "keyvault_location" {
1217
description = "Azure keyvault location"
1318
value = azurerm_key_vault.kv.location

keyvault-with-private-endpoint/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ variable "soft_delete_retention_days" {
101101
variable "virtual_network_name" {
102102
type = string
103103
description = "Name of the virtual network in which private endpoint will be created"
104-
default = ""
104+
default = ""
105105
}
106106

107107
variable "subnet_name" {
108108
type = string
109109
description = "Name of the subnet in which private endpoint will be created"
110-
default = ""
110+
default = ""
111111
}
112112

113113
variable "virtual_network_rg" {
114-
type = string
115-
default = "value"
114+
type = string
115+
default = "value"
116116
description = "Virtual network resource group"
117117
}

0 commit comments

Comments
 (0)