From ff34138afa43cbac3c2a23ac9191832a2b79b040 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Tue, 23 Apr 2024 12:19:24 +0200 Subject: [PATCH] identity --- .identity/00_data.tf | 11 +- ...nvironment.tf => 01_github_environment.tf} | 2 +- .identity/02_application_action.tf | 96 ----- pom.xml | 362 +++++++++--------- 4 files changed, 190 insertions(+), 281 deletions(-) rename .identity/{03_github_environment.tf => 01_github_environment.tf} (97%) delete mode 100644 .identity/02_application_action.tf diff --git a/.identity/00_data.tf b/.identity/00_data.tf index 8273e727..9e17ceda 100644 --- a/.identity/00_data.tf +++ b/.identity/00_data.tf @@ -1,4 +1,4 @@ -data "azurerm_storage_account" "tf_storage_account"{ +data "azurerm_storage_account" "tf_storage_account" { name = "pagopainfraterraform${var.env}" resource_group_name = "io-infra-rg" } @@ -17,14 +17,19 @@ data "github_organization_teams" "all" { summary_only = true } +data "azurerm_user_assigned_identity" "identity_cd_01" { + name = "${local.prefix}-${var.env_short}-${local.domain}-01-github-cd-identity" + resource_group_name = "${local.prefix}-${var.env_short}-identity-rg" +} + data "azurerm_key_vault" "key_vault" { name = "pagopa-${var.env_short}-kv" resource_group_name = "pagopa-${var.env_short}-sec-rg" } data "azurerm_key_vault" "domain_key_vault" { - name = "pagopa-${var.env_short}-${local.domain}-kv" - resource_group_name = "pagopa-${var.env_short}-${local.domain}-sec-rg" + name = "pagopa-${var.env_short}-itn-${local.domain}-kv" + resource_group_name = "pagopa-${var.env_short}-itn-${local.domain}-sec-rg" } data "azurerm_resource_group" "apim_resource_group" { diff --git a/.identity/03_github_environment.tf b/.identity/01_github_environment.tf similarity index 97% rename from .identity/03_github_environment.tf rename to .identity/01_github_environment.tf index 0f942706..ec4caad5 100644 --- a/.identity/03_github_environment.tf +++ b/.identity/01_github_environment.tf @@ -21,7 +21,7 @@ resource "github_repository_environment" "github_repository_environment" { locals { env_secrets = { - "CLIENT_ID" : module.github_runner_app.application_id, + "CLIENT_ID" : data.azurerm_user_assigned_identity.identity_cd_01.client_id, "TENANT_ID" : data.azurerm_client_config.current.tenant_id, "SUBSCRIPTION_ID" : data.azurerm_subscription.current.subscription_id, "SUBKEY" : data.azurerm_key_vault_secret.key_vault_integration_test_subkey.value, diff --git a/.identity/02_application_action.tf b/.identity/02_application_action.tf deleted file mode 100644 index d6a7a245..00000000 --- a/.identity/02_application_action.tf +++ /dev/null @@ -1,96 +0,0 @@ -module "github_runner_app" { - source = "git::https://github.com/pagopa/github-actions-tf-modules.git//app-github-runner-creator?ref=main" - - app_name = local.app_name - - subscription_id = data.azurerm_subscription.current.id - - github_org = local.github.org - github_repository = local.github.repository - github_environment_name = var.env - - container_app_github_runner_env_rg = local.container_app_environment.resource_group -} - -resource "null_resource" "github_runner_app_permissions_to_namespace" { - triggers = { - aks_id = data.azurerm_kubernetes_cluster.aks.id - service_principal_id = module.github_runner_app.client_id - namespace = local.domain - version = "v2" - } - - provisioner "local-exec" { - command = < - 4.0.0 - - - org.springframework.boot - spring-boot-starter-parent - 3.2.3 - - - it.gov.pagopa - print-payment-notices-service - 0.0.0 - pagopa-print-payment-notice-service - PagoPA Print Payment Notices Service - - - 17 - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-validation - - - - - org.springframework.boot - spring-boot-devtools - runtime - true - - - org.springframework.boot - spring-boot-configuration-processor - true - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springframework.boot - spring-boot-starter-cache - - - com.github.ben-manes.caffeine - caffeine - - - - - org.springdoc - springdoc-openapi-starter-webmvc-ui - 2.3.0 - - - - - - io.swagger - swagger-annotations - 1.6.12 - - - - - org.hibernate.orm - hibernate-core - 6.4.0.Final - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - de.flapdoodle.embed - de.flapdoodle.embed.mongo - 4.12.2 - test - - - - org.springframework.cloud - spring-cloud-starter-openfeign - 4.1.1 - - - - - org.modelmapper - modelmapper - 3.1.0 - - - org.projectlombok - lombok - true - - - - junit - junit - test - - - co.elastic.logging - logback-ecs-encoder - 1.5.0 - - - - - - + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.springframework.boot - spring-boot-maven-plugin - - - - org.jacoco - jacoco-maven-plugin - 0.8.7 - - - - - - - - prepare-agent - - - - report - test - - report - - - - - - org.sonarsource.scanner.maven - sonar-maven-plugin - 3.7.0.1746 - - - verify - - sonar - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 17 - 17 - - - - - - src/test/resources - true - - - + spring-boot-starter-parent + 3.2.3 + + + it.gov.pagopa + print-payment-notices-service + 0.0.0 + pagopa-print-payment-notice-service + PagoPA Print Payment Notices Service + + + 17 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-validation + + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-cache + + + com.github.ben-manes.caffeine + caffeine + + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.3.0 + + + + + + io.swagger + swagger-annotations + 1.6.12 + + + + + org.hibernate.orm + hibernate-core + 6.4.0.Final + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + de.flapdoodle.embed + de.flapdoodle.embed.mongo + 4.12.2 + test + + + + org.springframework.cloud + spring-cloud-starter-openfeign + 4.1.1 + + + + + org.modelmapper + modelmapper + 3.1.0 + + + org.projectlombok + lombok + true + + + + junit + junit + test + + + co.elastic.logging + logback-ecs-encoder + 1.5.0 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + + + + + + + prepare-agent + + + + report + test + + report + + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.7.0.1746 + + + verify + + sonar + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 17 + 17 + + + + + + src/test/resources + true + + +