-
Notifications
You must be signed in to change notification settings - Fork 2
feat: create private endpoint for key vault apps service #1252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
fc735b9
cb6314d
cd35e10
edafbd2
eb8cfe6
41dede7
26030b5
39fc020
6bd6aa5
4b55b64
aa53974
792ec12
33d8d63
27443c0
df156e8
783f3bf
2c7fedc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| resource "azurerm_key_vault" "environment_key_vault" { | ||
| #checkov:skip=CKV_AZURE_42: Soft delete protection enabled by default in latest Azure provider | ||
| #checkov:skip=CKV_AZURE_109: TODO: Network ACL, currently not implemented as it blocks pipeline | ||
| #checkov:skip=CKV_AZURE_189: TODO: Ensure that Azure Key Vault disables public network access | ||
| #checkov:skip=CKV2_AZURE_32: "Ensure private endpoint is configured to key vault" | ||
| name = replace("pinskv${local.service_name}${local.kv_resource_suffix}", "-", "") | ||
| location = azurerm_resource_group.common_infrastructure.location | ||
| resource_group_name = azurerm_resource_group.common_infrastructure.name | ||
| enabled_for_disk_encryption = true | ||
| purge_protection_enabled = true | ||
| soft_delete_retention_days = 7 | ||
| tenant_id = data.azurerm_client_config.current.tenant_id | ||
|
|
||
| sku_name = "standard" | ||
| name = replace("pinskv${local.service_name}${local.kv_resource_suffix}", "-", "") | ||
| location = azurerm_resource_group.common_infrastructure.location | ||
| resource_group_name = azurerm_resource_group.common_infrastructure.name | ||
| enabled_for_disk_encryption = true | ||
| purge_protection_enabled = true | ||
| soft_delete_retention_days = 7 | ||
| tenant_id = data.azurerm_client_config.current.tenant_id | ||
| sku_name = "standard" | ||
| public_network_access_enabled = false | ||
|
|
||
| network_acls { | ||
| bypass = "AzureServices" | ||
| default_action = "Deny" | ||
| } | ||
|
|
||
| tags = local.tags | ||
| } | ||
|
|
@@ -101,6 +103,10 @@ resource "azurerm_key_vault_secret" "applications_service_vpn_gateway_shared_key | |
| name = "applications-service-vpn-gateway-shared-key" | ||
| value = "<enter_value>" | ||
|
|
||
| depends_on = [ | ||
| azurerm_private_endpoint.keyvault, | ||
| ] | ||
|
|
||
| tags = local.tags | ||
|
|
||
| lifecycle { | ||
|
|
@@ -109,3 +115,31 @@ resource "azurerm_key_vault_secret" "applications_service_vpn_gateway_shared_key | |
| ] | ||
| } | ||
| } | ||
|
|
||
| resource "azurerm_private_endpoint" "keyvault" { | ||
| name = "pins-pe-keyvault-${local.resource_suffix}" | ||
| location = azurerm_resource_group.common_infrastructure.location # This is throwing up errors? | ||
| resource_group_name = azurerm_resource_group.common_infrastructure.name | ||
| subnet_id = azurerm_subnet.private_endpoints.id # Not sure on which subnet it lives | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a new one will be created |
||
|
|
||
| private_dns_zone_group { | ||
| name = "pins-pdns-${local.service_name}-keyvault-${var.environment}" | ||
| private_dns_zone_ids = [data.azurerm_private_dns_zone.keyvault.id] | ||
| } | ||
|
|
||
| private_service_connection { | ||
| name = "pins-psc-keyvault-${local.resource_suffix}" | ||
| private_connection_resource_id = azurerm_key_vault.environment_key_vault.id | ||
| subresource_names = ["vault"] | ||
| is_manual_connection = false | ||
| } | ||
|
|
||
| tags = local.tags | ||
| } | ||
|
|
||
| resource "azurerm_subnet" "private_endpoints" { | ||
| name = "snet-private-endpoints" | ||
| resource_group_name = azurerm_resource_group.common_infrastructure.name | ||
| virtual_network_name = module.networking.vnet_name | ||
| address_prefixes = ["10.0.1.0/24"] # Ensure this doesn't overlap! | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this ip range needs to be double checked. It may need to be moved into networking section (this did break my pipeline when i did but probably not referencing it correctly). |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no errors, old code comment