Skip to content

Commit

Permalink
[CES-575] Remove Trial System dependency from IO (#1352)
Browse files Browse the repository at this point in the history
Co-authored-by: Krusty93 <andera.grillo@pagopa.it>
  • Loading branch information
Krusty93 and Krusty93 authored Dec 9, 2024
1 parent 2d8f57a commit 0eb5706
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 82 deletions.
4 changes: 2 additions & 2 deletions src/common/_modules/app_backend/app_settings.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ locals {
APP_MESSAGES_API_KEY = data.azurerm_key_vault_secret.app_backend_APP_MESSAGES_API_KEY[(var.index - 1) % local.app_messages_count].value
LOLLIPOP_API_URL = "https://${var.backend_hostnames.lollipop}"
LOLLIPOP_API_KEY = data.azurerm_key_vault_secret.app_backend_LOLLIPOP_ITN_API_KEY.value
TRIAL_SYSTEM_API_URL = "https://${var.backend_hostnames.trial_system_api}" # PROD-TRIAL subscription
TRIAL_SYSTEM_APIM_URL = var.backend_hostnames.trial_system_apim # Add this variable to avoid downtime
TRIAL_SYSTEM_API_URL = "https://ts-p-itn-api-func-01.azurewebsites.net" # not working anymore
TRIAL_SYSTEM_APIM_URL = "https://ts-p-itn-apim-01.azure-api.net" # not working anymore
TRIAL_SYSTEM_API_KEY = data.azurerm_key_vault_secret.app_backend_TRIAL_SYSTEM_API_KEY.value
TRIAL_SYSTEM_APIM_KEY = data.azurerm_key_vault_secret.app_backend_TRIAL_SYSTEM_APIM_KEY.value
IO_WALLET_API_URL = "https://${var.backend_hostnames.iowallet}"
Expand Down
2 changes: 1 addition & 1 deletion src/common/_modules/app_backend/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ locals {
}
}

}
}
2 changes: 0 additions & 2 deletions src/common/_modules/app_backend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ variable "backend_hostnames" {
iosign = string
iofims = string
cgnonboarding = string
trial_system_api = string
trial_system_apim = string
iowallet = string
})
}
5 changes: 4 additions & 1 deletion src/common/_modules/cosmos_api/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ locals {
name = "notifications"
partition_key_path = "/messageId"
partition_key_version = null
throughput = 3800

autoscale_settings = {
max_throughput = 10000
}
},
{
name = "operations-leases-services"
Expand Down
15 changes: 0 additions & 15 deletions src/common/_modules/monitoring/ag.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,6 @@ resource "azurerm_monitor_action_group" "quarantine_error" {
tags = var.tags
}

# the action group that publish to the channel of the trial-system project
resource "azurerm_monitor_action_group" "trial_system_error" {
resource_group_name = var.resource_group_common
name = try(local.nonstandard[var.location_short].ag_ts_error, "${var.project}-ts-error-ag-01")
short_name = try(local.nonstandard[var.location_short].ag_ts_error_short, "${var.project}-ts-error-ag-01")

email_receiver {
name = "slack"
email_address = data.azurerm_key_vault_secret.alert_error_trial_slack.value
use_common_alert_schema = true
}

tags = var.tags
}

resource "azurerm_monitor_action_group" "email" {
name = try(local.nonstandard[var.location_short].email_pagopa, "${var.project}-email-ag-01")
resource_group_name = var.resource_group_common
Expand Down
6 changes: 0 additions & 6 deletions src/common/_modules/monitoring/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,3 @@ data "azurerm_key_vault_secret" "alert_error_notification_opsgenie" {
name = "alert-error-notification-opsgenie"
key_vault_id = var.kv_id
}

# point to the channel of the trial-system project
data "azurerm_key_vault_secret" "alert_error_trial_slack" {
name = "alert-error-trial-slack"
key_vault_id = var.kv_id
}
3 changes: 0 additions & 3 deletions src/common/_modules/monitoring/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ locals {
ag_quarantine_error = "${local.ag_formatted_project}quarantineerror"
ag_quarantine_error_short = "${local.ag_formatted_project}qerr"

ag_ts_error = "${local.ag_formatted_project}trialsystemerror"
ag_ts_error_short = "${replace(var.project, "-", "")}tserr"

email_pagopa = "EmailPagoPA"
slack_pagopa = "SlackPagoPA"
}
Expand Down
9 changes: 4 additions & 5 deletions src/common/_modules/monitoring/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
output "action_groups" {
value = {
error = azurerm_monitor_action_group.error.id
quarantine_error = azurerm_monitor_action_group.quarantine_error.id
trial_system_error = azurerm_monitor_action_group.trial_system_error.id
email = azurerm_monitor_action_group.email.id
slack = azurerm_monitor_action_group.slack.id
error = azurerm_monitor_action_group.error.id
quarantine_error = azurerm_monitor_action_group.quarantine_error.id
email = azurerm_monitor_action_group.email.id
slack = azurerm_monitor_action_group.slack.id
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/common/prod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
|------|---------|
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 2.53.1 |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.116.0 |
| <a name="provider_azurerm.prod-trial"></a> [azurerm.prod-trial](#provider\_azurerm.prod-trial) | 3.116.0 |
| <a name="provider_terraform"></a> [terraform](#provider\_terraform) | n/a |

## Modules
Expand Down Expand Up @@ -42,7 +41,6 @@
| [azurerm_role_assignment.dev_portal_role](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azuread_service_principal.apim_client_svc](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azuread_service_principal.dev_portal_svc](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |
| [azurerm_api_management.trial_system](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source |
| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source |
| [azurerm_linux_function_app.app_messages_xl](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_linux_function_app.eucovidcert](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
Expand Down
6 changes: 0 additions & 6 deletions src/common/prod/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ data "azurerm_linux_function_app" "wallet_user" {
name = "${local.project_itn}-wallet-user-func-02"
}

data "azurerm_api_management" "trial_system" {
provider = azurerm.prod-trial
name = "ts-p-itn-apim-01"
resource_group_name = "ts-p-itn-routing-rg-01"
}

data "azurerm_subnet" "admin_snet" {
name = "${local.project_weu_legacy}-admin-snet"
resource_group_name = local.core.networking.weu.vnet_common.resource_group_name
Expand Down
2 changes: 0 additions & 2 deletions src/common/prod/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ locals {
iosign = data.azurerm_linux_function_app.io_sign_user.default_hostname
iofims = data.azurerm_linux_function_app.io_fims_user.default_hostname
cgnonboarding = "io-p-itn-cgn-search-func-01.azurewebsites.net"
trial_system_api = "ts-p-itn-api-func-01.azurewebsites.net"
trial_system_apim = data.azurerm_api_management.trial_system.gateway_url
iowallet = data.azurerm_linux_function_app.wallet_user.default_hostname
}

Expand Down
7 changes: 0 additions & 7 deletions src/common/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,3 @@ terraform {
provider "azurerm" {
features {}
}

provider "azurerm" {
alias = "prod-trial"
subscription_id = "a2124115-ba74-462f-832a-9192cbd03649"

features {}
}
4 changes: 0 additions & 4 deletions src/identity/prod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
| Name | Version |
|------|---------|
| <a name="provider_azurerm.prod-cgn"></a> [azurerm.prod-cgn](#provider\_azurerm.prod-cgn) | 3.116.0 |
| <a name="provider_azurerm.prod-trial"></a> [azurerm.prod-trial](#provider\_azurerm.prod-trial) | 3.116.0 |

## Modules

Expand All @@ -27,12 +26,9 @@
|------|------|
| [azurerm_role_assignment.cd_cgn](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_role_assignment.cd_cgn_postgresql](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_role_assignment.cd_trial_system](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_role_assignment.ci_cgn](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_role_assignment.ci_trial_system](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_postgresql_server.cgn_psql](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/postgresql_server) | data source |
| [azurerm_subscription.cgn](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subscription) | data source |
| [azurerm_subscription.trial_system](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subscription) | data source |

## Inputs

Expand Down
6 changes: 1 addition & 5 deletions src/identity/prod/data.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
data "azurerm_subscription" "trial_system" {
provider = azurerm.prod-trial
}

data "azurerm_subscription" "cgn" {
provider = azurerm.prod-cgn
}
Expand All @@ -10,4 +6,4 @@ data "azurerm_postgresql_server" "cgn_psql" {
provider = azurerm.prod-cgn
name = "cgnonboardingportal-p-db-postgresql"
resource_group_name = "cgnonboardingportal-p-db-rg"
}
}
21 changes: 0 additions & 21 deletions src/identity/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ provider "azurerm" {
}
}

provider "azurerm" {
alias = "prod-trial"
subscription_id = "a2124115-ba74-462f-832a-9192cbd03649"

features {}
}

provider "azurerm" {
alias = "prod-cgn"
subscription_id = "74da48a3-b0e7-489d-8172-da79801086ed"
Expand Down Expand Up @@ -86,20 +79,6 @@ module "federated_identities" {
tags = local.tags
}

resource "azurerm_role_assignment" "ci_trial_system" {
provider = azurerm.prod-trial
scope = data.azurerm_subscription.trial_system.id
principal_id = module.federated_identities.federated_ci_identity.id
role_definition_name = "Reader"
}

resource "azurerm_role_assignment" "cd_trial_system" {
provider = azurerm.prod-trial
scope = data.azurerm_subscription.trial_system.id
principal_id = module.federated_identities.federated_cd_identity.id
role_definition_name = "Reader"
}

resource "azurerm_role_assignment" "ci_cgn" {
provider = azurerm.prod-cgn
scope = data.azurerm_subscription.cgn.id
Expand Down

0 comments on commit 0eb5706

Please sign in to comment.