Skip to content

Commit

Permalink
feat: Printit Eventhub on DEV & UAT (#2217)
Browse files Browse the repository at this point in the history
* upgrated providers to last version

* migrated eventhub in prod

* removed eventhub from prod core

* fix eventhubs in UAT and DEV

* pre-commit fixs

* pre-commit fixs
  • Loading branch information
diegolagospagopa authored Jun 27, 2024
1 parent 7107bec commit 3d567bb
Show file tree
Hide file tree
Showing 28 changed files with 383 additions and 506 deletions.
12 changes: 0 additions & 12 deletions src/core-itn/00_network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ data "azurerm_resource_group" "rg_vnet_integration" {
name = local.vnet_integration_resource_group_name
}

#
# Eventhub
#
data "azurerm_private_dns_zone" "eventhub" {
name = "privatelink.servicebus.windows.net"
resource_group_name = local.msg_resource_group_name
}

data "azurerm_resource_group" "rg_event_private_dns_zone" {
name = local.msg_resource_group_name
}

#
# App GW integration
#
Expand Down
52 changes: 0 additions & 52 deletions src/core-itn/10_evenhubs.tf

This file was deleted.

4 changes: 0 additions & 4 deletions src/core-itn/99_locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@ locals {
vnet_integration_name = "${local.product}-vnet-integration"
vnet_integration_resource_group_name = "${local.product}-vnet-rg"


msg_resource_group_name = "${local.product}-msg-rg"
eventhub_resource_group_name = "${local.product_ita}-evenhub-rg"

}
80 changes: 0 additions & 80 deletions src/core-itn/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -171,86 +171,6 @@ variable "dns_default_ttl_sec" {
description = "Dns default ttl secs"
}

#
# Event hub
#
variable "ehns_auto_inflate_enabled" {
type = bool
description = "Is Auto Inflate enabled for the EventHub Namespace?"
default = false
}

variable "ehns_sku_name" {
type = string
description = "Defines which tier to use."
}

variable "ehns_capacity" {
type = number
description = "Specifies the Capacity / Throughput Units for a Standard SKU namespace."
}

variable "ehns_maximum_throughput_units" {
type = number
description = "Specifies the maximum number of throughput units when Auto Inflate is Enabled"
}

variable "ehns_zone_redundant" {
type = bool
description = "Specifies if the EventHub Namespace should be Zone Redundant (created across Availability Zones)."
}

# variable "ehns_alerts_enabled" {
# type = bool
# default = false
# description = "Event hub alerts enabled?"
# }

variable "ehns_public_network_access" {
type = bool
description = "(Required) enables public network access to the event hubs"
}

variable "ehns_private_endpoint_is_present" {
type = bool
description = "(Required) create private endpoint to the event hubs"
}

variable "ehns_metric_alerts_create" {
type = bool
description = "Create metrics alerts for eventhub"
}

variable "ehns_metric_alerts" {
default = {}

description = <<EOD
Map of name = criteria objects
EOD

type = map(object({
# criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]
aggregation = string
metric_name = string
description = string
# criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]
operator = string
threshold = number
# Possible values are PT1M, PT5M, PT15M, PT30M and PT1H
frequency = string
# Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D.
window_size = string

dimension = list(object(
{
name = string
operator = string
values = list(string)
}
))
}))
}

#
# Container registry
#
Expand Down
13 changes: 0 additions & 13 deletions src/core-itn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ No outputs.
|------|--------|---------|
| <a name="module_container_registry_ita"></a> [container\_registry\_ita](#module\_container\_registry\_ita) | git::https://github.com/pagopa/terraform-azurerm-v3.git//container_registry | v8.13.0 |
| <a name="module_domain_key_vault_secrets_query"></a> [domain\_key\_vault\_secrets\_query](#module\_domain\_key\_vault\_secrets\_query) | git::https://github.com/pagopa/terraform-azurerm-v3.git//key_vault_secrets_query | v8.13.0 |
| <a name="module_eventhub_meucci"></a> [eventhub\_meucci](#module\_eventhub\_meucci) | git::https://github.com/pagopa/terraform-azurerm-v3.git//eventhub | v8.13.0 |
| <a name="module_key_vault"></a> [key\_vault](#module\_key\_vault) | git::https://github.com/pagopa/terraform-azurerm-v3.git//key_vault | v8.13.0 |
| <a name="module_vnet_ita_peering"></a> [vnet\_ita\_peering](#module\_vnet\_ita\_peering) | git::https://github.com/pagopa/terraform-azurerm-v3.git//virtual_network_peering | v8.13.0 |
| <a name="module_vnet_ita_to_integration_peering"></a> [vnet\_ita\_to\_integration\_peering](#module\_vnet\_ita\_to\_integration\_peering) | git::https://github.com/pagopa/terraform-azurerm-v3.git//virtual_network_peering | v8.13.0 |
Expand Down Expand Up @@ -148,7 +147,6 @@ No outputs.
| [azurerm_private_dns_zone_virtual_network_link.privatelink_table_cosmos_azure_com_vnet_link](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_dns_zone_virtual_network_link) | resource |
| [azurerm_public_ip.aks_leonardo_public_ip](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) | resource |
| [azurerm_resource_group.acr_ita_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.eventhub_ita_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.monitor_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.rg_ita_vnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.sec_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
Expand All @@ -165,7 +163,6 @@ No outputs.
| [azurerm_key_vault_secret.monitor_notification_email](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source |
| [azurerm_key_vault_secret.monitor_notification_slack_email](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source |
| [azurerm_private_dns_zone.db_nodo_pagamenti_com](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_private_dns_zone.eventhub](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_private_dns_zone.internal_env_platform_pagopa_it](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_private_dns_zone.internal_postgresql_pagopa_it](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_private_dns_zone.privatelink_azurecr_io](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
Expand All @@ -178,7 +175,6 @@ No outputs.
| [azurerm_private_dns_zone.privatelink_servicebus_windows_net](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_private_dns_zone.privatelink_table_core_windows_net](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_private_dns_zone.privatelink_table_cosmos_azure_com](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_resource_group.rg_event_private_dns_zone](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [azurerm_resource_group.rg_vnet_core](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [azurerm_resource_group.rg_vnet_integration](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [azurerm_subscription.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subscription) | data source |
Expand All @@ -198,15 +194,6 @@ No outputs.
| <a name="input_dns_default_ttl_sec"></a> [dns\_default\_ttl\_sec](#input\_dns\_default\_ttl\_sec) | Dns default ttl secs | `number` | n/a | yes |
| <a name="input_dns_zone_internal_prefix"></a> [dns\_zone\_internal\_prefix](#input\_dns\_zone\_internal\_prefix) | The dns subdomain. | `string` | n/a | yes |
| <a name="input_domain"></a> [domain](#input\_domain) | n/a | `string` | n/a | yes |
| <a name="input_ehns_auto_inflate_enabled"></a> [ehns\_auto\_inflate\_enabled](#input\_ehns\_auto\_inflate\_enabled) | Is Auto Inflate enabled for the EventHub Namespace? | `bool` | `false` | no |
| <a name="input_ehns_capacity"></a> [ehns\_capacity](#input\_ehns\_capacity) | Specifies the Capacity / Throughput Units for a Standard SKU namespace. | `number` | n/a | yes |
| <a name="input_ehns_maximum_throughput_units"></a> [ehns\_maximum\_throughput\_units](#input\_ehns\_maximum\_throughput\_units) | Specifies the maximum number of throughput units when Auto Inflate is Enabled | `number` | n/a | yes |
| <a name="input_ehns_metric_alerts"></a> [ehns\_metric\_alerts](#input\_ehns\_metric\_alerts) | Map of name = criteria objects | <pre>map(object({<br> # criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]<br> aggregation = string<br> metric_name = string<br> description = string<br> # criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]<br> operator = string<br> threshold = number<br> # Possible values are PT1M, PT5M, PT15M, PT30M and PT1H<br> frequency = string<br> # Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D.<br> window_size = string<br><br> dimension = list(object(<br> {<br> name = string<br> operator = string<br> values = list(string)<br> }<br> ))<br> }))</pre> | `{}` | no |
| <a name="input_ehns_metric_alerts_create"></a> [ehns\_metric\_alerts\_create](#input\_ehns\_metric\_alerts\_create) | Create metrics alerts for eventhub | `bool` | n/a | yes |
| <a name="input_ehns_private_endpoint_is_present"></a> [ehns\_private\_endpoint\_is\_present](#input\_ehns\_private\_endpoint\_is\_present) | (Required) create private endpoint to the event hubs | `bool` | n/a | yes |
| <a name="input_ehns_public_network_access"></a> [ehns\_public\_network\_access](#input\_ehns\_public\_network\_access) | (Required) enables public network access to the event hubs | `bool` | n/a | yes |
| <a name="input_ehns_sku_name"></a> [ehns\_sku\_name](#input\_ehns\_sku\_name) | Defines which tier to use. | `string` | n/a | yes |
| <a name="input_ehns_zone_redundant"></a> [ehns\_zone\_redundant](#input\_ehns\_zone\_redundant) | Specifies if the EventHub Namespace should be Zone Redundant (created across Availability Zones). | `bool` | n/a | yes |
| <a name="input_env"></a> [env](#input\_env) | n/a | `string` | n/a | yes |
| <a name="input_env_short"></a> [env\_short](#input\_env\_short) | n/a | `string` | n/a | yes |
| <a name="input_external_domain"></a> [external\_domain](#input\_external\_domain) | Domain for delegation | `string` | `"pagopa.it"` | no |
Expand Down
59 changes: 0 additions & 59 deletions src/core-itn/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -59,65 +59,6 @@ monitor_resource_group_name = "pagopa-p-monitor-rg"
log_analytics_workspace_name = "pagopa-p-law"
log_analytics_workspace_resource_group_name = "pagopa-p-monitor-rg"


# to avoid https://docs.microsoft.com/it-it/azure/event-hubs/event-hubs-messaging-exceptions#error-code-50002
ehns_auto_inflate_enabled = true
ehns_maximum_throughput_units = 5
ehns_capacity = 5
ehns_zone_redundant = true
ehns_public_network_access = true
ehns_private_endpoint_is_present = true
ehns_sku_name = "Standard"
ehns_metric_alerts_create = true

ehns_metric_alerts = {
no_trx = {
aggregation = "Total"
metric_name = "IncomingMessages"
description = "No transactions received from acquirer in the last 24h"
operator = "LessThanOrEqual"
threshold = 1000
frequency = "PT1H"
window_size = "P1D"
dimension = [
{
name = "EntityName"
operator = "Include"
values = ["rtd-trx"]
}
],
},
active_connections = {
aggregation = "Average"
metric_name = "ActiveConnections"
description = null
operator = "LessThanOrEqual"
threshold = 0
frequency = "PT5M"
window_size = "PT15M"
dimension = [],
},
error_trx = {
aggregation = "Total"
metric_name = "IncomingMessages"
description = "Transactions rejected from one acquirer file received. trx write on eventhub. check immediately"
operator = "GreaterThan"
threshold = 0
frequency = "PT5M"
window_size = "PT30M"
dimension = [
{
name = "EntityName"
operator = "Include"
values = [
"nodo-dei-pagamenti-log",
"nodo-dei-pagamenti-re"
]
}
],
},
}

#
# Container registry ACR
#
Expand Down
28 changes: 14 additions & 14 deletions src/domains/printit-app/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/domains/printit-app/99_main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "<= 3.101.0"
version = "<= 3.106.0"
}
azuread = {
source = "hashicorp/azuread"
Expand Down
2 changes: 1 addition & 1 deletion src/domains/printit-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ No outputs.
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6.0 |
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | <= 2.47.0 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | <= 3.101.0 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | <= 3.106.0 |
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | <= 2.12.1 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | <= 2.29.0 |
| <a name="requirement_null"></a> [null](#requirement\_null) | <= 3.2.1 |
Expand Down
Loading

0 comments on commit 3d567bb

Please sign in to comment.