Skip to content

Commit 6c65d67

Browse files
authored
feat: Paymcloud-581 evh spoke streaming (#3639)
* prepared observability pe move * prepared payopt pe move * prepared printit pe move * added check on new pe creation * prepared qi pe move * added pe dns boolean enabler * precommit
1 parent a1f968f commit 6c65d67

35 files changed

+421
-34
lines changed

src/domains/observability/.terraform.lock.hcl

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/domains/observability/01_network.tf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,41 @@ resource "azurerm_subnet" "eventhub_observability_gpd_snet" {
4747

4848
private_endpoint_network_policies = "Enabled"
4949
}
50+
51+
module "eventhub_observability_spoke_pe_snet" {
52+
source = "./.terraform/modules/__v4__/IDH/subnet"
53+
env = var.env
54+
idh_resource_tier = "slash28_privatelink_true"
55+
name = "${local.project}-spoke-streaming-evh-pe-snet"
56+
product_name = var.prefix
57+
58+
resource_group_name = local.vnet_hub_spoke_rg_name
59+
virtual_network_name = local.vnet_spoke_streaming_name
60+
61+
custom_nsg_configuration = {
62+
target_service = "eventhub"
63+
source_address_prefixes_name = "All"
64+
source_address_prefixes = ["*"]
65+
}
66+
67+
tags = module.tag_config.tags
68+
}
69+
70+
module "eventhub_observability_gpd_spoke_pe_snet" {
71+
source = "./.terraform/modules/__v4__/IDH/subnet"
72+
env = var.env
73+
idh_resource_tier = "slash28_privatelink_true"
74+
name = "${local.project}-spoke-streaming-evh-gpd-pe-snet"
75+
product_name = var.prefix
76+
77+
resource_group_name = local.vnet_hub_spoke_rg_name
78+
virtual_network_name = local.vnet_spoke_streaming_name
79+
80+
custom_nsg_configuration = {
81+
target_service = "eventhub"
82+
source_address_prefixes_name = "All"
83+
source_address_prefixes = ["*"]
84+
}
85+
86+
tags = module.tag_config.tags
87+
}

src/domains/observability/03_eventhub_msg.tf

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ resource "azurerm_resource_group" "eventhub_observability_rg" {
55
tags = module.tag_config.tags
66
}
77

8+
9+
810
module "eventhub_namespace_observability" {
911
source = "./.terraform/modules/__v4__/eventhub"
1012

@@ -19,7 +21,7 @@ module "eventhub_namespace_observability" {
1921

2022
private_endpoint_subnet_id = azurerm_subnet.eventhub_observability_snet.id
2123
public_network_access_enabled = var.ehns_public_network_access
22-
private_endpoint_created = var.ehns_private_endpoint_is_present
24+
private_endpoint_created = var.ehns_private_endpoint_is_present && !var.is_feature_enabled.evh_spoke_pe
2325

2426
private_endpoint_resource_group_name = azurerm_resource_group.eventhub_observability_rg.name
2527

@@ -55,3 +57,31 @@ module "eventhub_observability_configuration" {
5557
eventhubs = var.eventhubs
5658
}
5759

60+
# hub spoke private endpoint
61+
resource "azurerm_private_endpoint" "eventhub_spoke_pe" {
62+
count = var.ehns_private_endpoint_is_present && var.is_feature_enabled.evh_spoke_pe ? 1 : 0
63+
64+
name = "${local.project}-evh-spoke-pe"
65+
location = var.location_itn
66+
resource_group_name = azurerm_resource_group.eventhub_observability_rg.name
67+
subnet_id = module.eventhub_observability_spoke_pe_snet.subnet_id
68+
69+
dynamic "private_dns_zone_group" {
70+
for_each = var.ehns_private_endpoint_is_present && var.is_feature_enabled.evh_spoke_pe_dns ? [1] : []
71+
content {
72+
name = "${local.project}-evh-spoke-private-dns-zone-group"
73+
private_dns_zone_ids = [data.azurerm_private_dns_zone.eventhub.id]
74+
}
75+
}
76+
77+
78+
private_service_connection {
79+
name = "${local.project}-evh-spoke-private-service-connection"
80+
private_connection_resource_id = module.eventhub_namespace_observability.namespace_id
81+
is_manual_connection = false
82+
subresource_names = ["namespace"]
83+
}
84+
85+
tags = module.tag_config.tags
86+
}
87+

src/domains/observability/03_eventhub_msg_gdp.tf

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module "eventhub_namespace_observability_gpd" {
1313

1414
private_endpoint_subnet_id = azurerm_subnet.eventhub_observability_gpd_snet.id
1515
public_network_access_enabled = var.ehns_public_network_access
16-
private_endpoint_created = var.ehns_private_endpoint_is_present
16+
private_endpoint_created = var.ehns_private_endpoint_is_present && !var.is_feature_enabled.evh_spoke_pe
1717

1818
private_endpoint_resource_group_name = azurerm_resource_group.eventhub_observability_rg.name
1919

@@ -49,6 +49,34 @@ module "eventhub_observability_gpd_configuration" {
4949
eventhubs = var.eventhubs_gpd
5050
}
5151

52+
# hub spoke private endpoint
53+
resource "azurerm_private_endpoint" "eventhub_gpd_spoke_pe" {
54+
count = var.ehns_private_endpoint_is_present && var.is_feature_enabled.evh_spoke_pe ? 1 : 0
55+
56+
name = "${local.project}-evh-gpd-spoke-pe"
57+
location = var.location_itn
58+
resource_group_name = azurerm_resource_group.eventhub_observability_rg.name
59+
subnet_id = module.eventhub_observability_gpd_spoke_pe_snet.subnet_id
60+
61+
dynamic "private_dns_zone_group" {
62+
for_each = var.ehns_private_endpoint_is_present && var.is_feature_enabled.evh_spoke_pe_dns ? [1] : []
63+
content {
64+
name = "${local.project}-evh-gpd-spoke-private-dns-zone-group"
65+
private_dns_zone_ids = [data.azurerm_private_dns_zone.eventhub.id]
66+
}
67+
}
68+
69+
70+
private_service_connection {
71+
name = "${local.project}-evh-spoke-private-service-connection"
72+
private_connection_resource_id = module.eventhub_namespace_observability_gpd.namespace_id
73+
is_manual_connection = false
74+
subresource_names = ["namespace"]
75+
}
76+
77+
tags = module.tag_config.tags
78+
}
79+
5280
resource "azurerm_eventhub_namespace_authorization_rule" "cdc_connection_string" {
5381
name = "cdc-gpd-connection-string"
5482
namespace_name = module.eventhub_namespace_observability_gpd.name

src/domains/observability/99_locals.tf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
locals {
2-
project = "${var.prefix}-${var.env_short}-${var.location_short}-${var.domain}"
3-
project_itn = "${var.prefix}-${var.env_short}-${var.location_short_itn}-${var.domain}"
4-
project_legacy = "${var.prefix}-${var.env_short}"
5-
product = "${var.prefix}-${var.env_short}"
6-
product_network = "${var.prefix}-${var.env_short}-${var.location_short}-network"
2+
project = "${var.prefix}-${var.env_short}-${var.location_short}-${var.domain}"
3+
project_itn = "${var.prefix}-${var.env_short}-${var.location_short_itn}-${var.domain}"
4+
project_legacy = "${var.prefix}-${var.env_short}"
5+
product = "${var.prefix}-${var.env_short}"
6+
product_location_itn = "${var.prefix}-${var.env_short}-${var.location_short_itn}"
7+
product_network = "${var.prefix}-${var.env_short}-${var.location_short}-network"
78

89
apim_hostname = "api.${var.apim_dns_zone_prefix}.${var.external_domain}"
910

@@ -26,6 +27,9 @@ locals {
2627
vnet_italy_name = "${local.product}-itn-vnet"
2728
vnet_italy_resource_group_name = "${local.product}-itn-vnet-rg"
2829

30+
vnet_hub_spoke_rg_name = "${local.product_location_itn}-network-hub-spoke-rg"
31+
vnet_spoke_streaming_name = "${local.product_location_itn}-spoke-streaming-vnet"
32+
2933
dataexplorer_ls_name = "AzureDataExplorer${var.env_short}LinkService"
3034

3135
linked_service_cruscotto_kv_name = "crusc8-${var.env_short}-key-vault"

src/domains/observability/99_variables.tf

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,16 @@ variable "gpd_ingestion_storage_account" {
380380
}
381381
}
382382

383+
variable "is_feature_enabled" {
384+
type = object({
385+
evh_spoke_pe = optional(bool, false)
386+
evh_spoke_pe_dns = optional(bool, false)
387+
388+
})
389+
390+
default = {
391+
evh_spoke_pe = false
392+
evh_spoke_pe_dns = false
393+
}
383394

384-
variable "app_forwarder_ip_restriction_default_action" {
385-
type = string
386-
description = "(Required) The Default action for traffic that does not match any ip_restriction rule. possible values include Allow and Deny. "
387395
}

src/domains/observability/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
| <a name="module_eventhub_namespace_observability_gpd"></a> [eventhub\_namespace\_observability\_gpd](#module\_eventhub\_namespace\_observability\_gpd) | ./.terraform/modules/__v4__/eventhub | n/a |
2121
| <a name="module_eventhub_observability_configuration"></a> [eventhub\_observability\_configuration](#module\_eventhub\_observability\_configuration) | ./.terraform/modules/__v4__/eventhub_configuration | n/a |
2222
| <a name="module_eventhub_observability_gpd_configuration"></a> [eventhub\_observability\_gpd\_configuration](#module\_eventhub\_observability\_gpd\_configuration) | ./.terraform/modules/__v4__/eventhub_configuration | n/a |
23+
| <a name="module_eventhub_observability_gpd_spoke_pe_snet"></a> [eventhub\_observability\_gpd\_spoke\_pe\_snet](#module\_eventhub\_observability\_gpd\_spoke\_pe\_snet) | ./.terraform/modules/__v4__/IDH/subnet | n/a |
24+
| <a name="module_eventhub_observability_spoke_pe_snet"></a> [eventhub\_observability\_spoke\_pe\_snet](#module\_eventhub\_observability\_spoke\_pe\_snet) | ./.terraform/modules/__v4__/IDH/subnet | n/a |
2325
| <a name="module_gpd_ingestion_sa"></a> [gpd\_ingestion\_sa](#module\_gpd\_ingestion\_sa) | ./.terraform/modules/__v4__/storage_account | n/a |
2426
| <a name="module_observability_sa"></a> [observability\_sa](#module\_observability\_sa) | ./.terraform/modules/__v4__/storage_account | n/a |
2527
| <a name="module_observability_st_snet"></a> [observability\_st\_snet](#module\_observability\_st\_snet) | ./.terraform/modules/__v4__/subnet | n/a |
@@ -113,6 +115,8 @@
113115
| [azurerm_kusto_eventhub_data_connection.eventhub_connection_for_ingestion_qi_iuvs](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kusto_eventhub_data_connection) | resource |
114116
| [azurerm_kusto_eventhub_data_connection.eventhub_connection_for_re_event](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kusto_eventhub_data_connection) | resource |
115117
| [azurerm_kusto_script.create_merge_table](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kusto_script) | resource |
118+
| [azurerm_private_endpoint.eventhub_gpd_spoke_pe](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint) | resource |
119+
| [azurerm_private_endpoint.eventhub_spoke_pe](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint) | resource |
116120
| [azurerm_private_endpoint.observability_storage_private_endpoint](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint) | resource |
117121
| [azurerm_resource_group.eventhub_observability_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
118122
| [azurerm_resource_group.gpd_ingestion_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
@@ -172,7 +176,6 @@
172176
|------|-------------|------|---------|:--------:|
173177
| <a name="input_apim_dns_zone_prefix"></a> [apim\_dns\_zone\_prefix](#input\_apim\_dns\_zone\_prefix) | The dns subdomain for apim. | `string` | `null` | no |
174178
| <a name="input_app_forwarder_enabled"></a> [app\_forwarder\_enabled](#input\_app\_forwarder\_enabled) | Enable app\_forwarder | `bool` | `false` | no |
175-
| <a name="input_app_forwarder_ip_restriction_default_action"></a> [app\_forwarder\_ip\_restriction\_default\_action](#input\_app\_forwarder\_ip\_restriction\_default\_action) | (Required) The Default action for traffic that does not match any ip\_restriction rule. possible values include Allow and Deny. | `string` | n/a | yes |
176179
| <a name="input_cidr_subnet_observability_evh"></a> [cidr\_subnet\_observability\_evh](#input\_cidr\_subnet\_observability\_evh) | Address prefixes evh | `list(string)` | n/a | yes |
177180
| <a name="input_cidr_subnet_observability_gpd_evh"></a> [cidr\_subnet\_observability\_gpd\_evh](#input\_cidr\_subnet\_observability\_gpd\_evh) | Address prefixes evh | `list(string)` | n/a | yes |
178181
| <a name="input_cidr_subnet_observability_storage"></a> [cidr\_subnet\_observability\_storage](#input\_cidr\_subnet\_observability\_storage) | Storage address space | `list(string)` | `null` | no |
@@ -199,6 +202,7 @@
199202
| <a name="input_external_domain"></a> [external\_domain](#input\_external\_domain) | Domain for delegation | `string` | `null` | no |
200203
| <a name="input_gpd_ingestion_storage_account"></a> [gpd\_ingestion\_storage\_account](#input\_gpd\_ingestion\_storage\_account) | n/a | <pre>object({<br/> advanced_threat_protection = bool<br/> blob_delete_retention_days = number<br/> blob_versioning_enabled = bool<br/> backup_enabled = bool<br/> backup_retention = optional(number, 0)<br/> account_replication_type = string<br/> public_network_access_enabled = bool<br/><br/> })</pre> | <pre>{<br/> "account_replication_type": "LRS",<br/> "advanced_threat_protection": false,<br/> "backup_enabled": false,<br/> "backup_retention": 0,<br/> "blob_delete_retention_days": 30,<br/> "blob_versioning_enabled": false,<br/> "public_network_access_enabled": true<br/>}</pre> | no |
201204
| <a name="input_instance"></a> [instance](#input\_instance) | One of beta, prod01, prod02 | `string` | n/a | yes |
205+
| <a name="input_is_feature_enabled"></a> [is\_feature\_enabled](#input\_is\_feature\_enabled) | n/a | <pre>object({<br/> evh_spoke_pe = optional(bool, false)<br/> evh_spoke_pe_dns = optional(bool, false)<br/><br/> })</pre> | <pre>{<br/> "evh_spoke_pe": false,<br/> "evh_spoke_pe_dns": false<br/>}</pre> | no |
202206
| <a name="input_location"></a> [location](#input\_location) | One of westeurope, northeurope | `string` | n/a | yes |
203207
| <a name="input_location_itn"></a> [location\_itn](#input\_location\_itn) | italynorth | `string` | n/a | yes |
204208
| <a name="input_location_short"></a> [location\_short](#input\_location\_short) | One of wue, neu | `string` | n/a | yes |

src/domains/observability/env/dev/terraform.tfvars

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,9 @@ app_forwarder_ip_restriction_default_action = "Allow"
370370
# ],
371371
# },
372372
# }
373+
374+
375+
is_feature_enabled = {
376+
evh_spoke_pe = true
377+
evh_spoke_pe_dns = false
378+
}

src/domains/observability/env/prod/terraform.tfvars

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,3 +412,7 @@ app_forwarder_ip_restriction_default_action = "Deny"
412412
# ],
413413
# },
414414
# }
415+
416+
is_feature_enabled = {
417+
evh_spoke_pe = false
418+
}

src/domains/observability/env/uat/terraform.tfvars

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,3 +387,9 @@ ehns_metric_alerts_gpd = {
387387
],
388388
},
389389
}
390+
391+
392+
is_feature_enabled = {
393+
evh_spoke_pe = true
394+
evh_spoke_pe_dns = true
395+
}

0 commit comments

Comments
 (0)