Skip to content

Commit

Permalink
chore(shared-app): Authorizer migration to AKS [PAGOPA-1678] (#2052)
Browse files Browse the repository at this point in the history
* [PAGOPA-1678] chore: Update cache_generator_hostname

* [PAGOPA-1678] feat(shared): Add authorizer federated identity

* [PAGOPA-1678] chore(shared): Update status-page

* [PAGOPA-1678] chore(shared): Update
  • Loading branch information
cap-ang authored May 24, 2024
1 parent 304a435 commit eb89a3b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/domains/shared-app/04_apim_statuspage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ module "apim_api_statuspage_api_v1" {
"apiconfigcacheo" = format("%s/api-config-cache/o", format(local.aks_path, "apiconfig"))
"apiconfigcachep" = format("%s/api-config-cache/p", format(local.aks_path, "apiconfig"))
"apiconfigselfcare" = format("%s/pagopa-api-config-selfcare-integration", format(local.aks_path, "apiconfig"))
"authorizer" = format("%s/", data.azurerm_function_app.authorizer.default_hostname)
"authorizer" = format("%s//authorizer-functions", format(local.aks_path, "shared"))
"authorizerconfig" = format("%s//authorizer-config", format(local.aks_path, "shared"))
"bizevents" = format("%s/pagopa-biz-events-service", format(local.aks_path, "bizevents"))
"bizeventsdatastoreneg" = format("%s/pagopa-negative-biz-events-datastore-service", format(local.aks_path, "bizevents"))
Expand Down
15 changes: 7 additions & 8 deletions src/domains/shared-app/05_authorizer_functions.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

// todo: remove and destroy
locals {

authorizer_functions_app_settings = {
linux_fx_version = "JAVA|11"
FUNCTIONS_WORKER_RUNTIME = "java"
Expand All @@ -22,7 +21,7 @@ locals {
IS_EC_ENROLLED_SQL_QUERY = "SELECT VALUE COUNT(i) FROM c JOIN i IN c.authorization WHERE c.domain = {domain} AND ARRAY_CONTAINS(c.authorization, {organizationFiscalCode})"
}
}

// todo: remove and destroy
# Subnet to host authorizer function
module "authorizer_functions_snet" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//subnet?ref=v6.6.0"
Expand All @@ -44,11 +43,11 @@ module "authorizer_functions_snet" {
}
}
}

// todo: remove and destroy
data "azurerm_resource_group" "shared_rg" {
name = "${local.project}-rg"
}

// todo: remove and destroy
module "authorizer_function_app" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//function_app?ref=v7.29.0"

Expand Down Expand Up @@ -105,7 +104,7 @@ module "authorizer_function_app" {

tags = var.tags
}

// todo: remove and destroy
module "authorizer_function_app_slot_staging" {
count = var.env_short == "p" ? 1 : 0

Expand Down Expand Up @@ -140,7 +139,7 @@ module "authorizer_function_app_slot_staging" {

tags = var.tags
}

// todo: remove and destroy
resource "azurerm_monitor_autoscale_setting" "authorizer_function" {
count = var.env_short != "d" ? 1 : 0

Expand Down Expand Up @@ -203,7 +202,7 @@ resource "azurerm_monitor_autoscale_setting" "authorizer_function" {
}
}
}

// todo: remove and destroy
data "azurerm_container_registry" "acr" {
name = local.acr_name
resource_group_name = local.acr_resource_group_name
Expand Down
4 changes: 2 additions & 2 deletions src/domains/shared-app/99_locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ locals {
apim_hostname = "api.${var.apim_dns_zone_prefix}.${var.external_domain}"
shared_hostname = var.env == "prod" ? "weuprod.shared.internal.platform.pagopa.it" : "weu${var.env}.shared.internal.${var.env}.platform.pagopa.it"

cache_generator_hostname = "${var.prefix}-${var.env_short}-${var.location_short}-shared-authorizer-fn.azurewebsites.net/api"
cache_generator_hostname_2 = "${var.prefix}-${var.env_short}-${var.location_short}-shared-authorizer-fn.azurewebsites.net"
cache_generator_hostname = "${local.shared_hostname}/authorizer-functions/api"
cache_generator_hostname_2 = "${local.shared_hostname}/authorizer-functions"

authorizer_config_hostname = "${local.shared_hostname}/authorizer-config"

Expand Down
16 changes: 0 additions & 16 deletions src/domains/shared-common/.terraform.lock.hcl

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

3 changes: 3 additions & 0 deletions src/domains/shared-common/10_github_identity.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ data "azurerm_kubernetes_cluster" "aks" {
locals {
repos_01 = [
"pagopa-shared-toolbox",
"pagopa-platform-authorizer",
"pagopa-platform-authorizer-config",
"pagopa-infra"
]

federations_01 = [
Expand Down

0 comments on commit eb89a3b

Please sign in to comment.