From 52750fb00c15b7c7de9f331513c74e0248ddab98 Mon Sep 17 00:00:00 2001 From: Andrea Grillo Date: Thu, 2 Nov 2023 11:56:32 +0100 Subject: [PATCH] bunch of changes after PR --- .container_app/locals.tf | 35 ------------------- .../onboarding-ms}/.terraform.lock.hcl | 0 .../onboarding-ms}/container_app.tf | 5 ++- .../onboarding-ms}/env/dev/backend.ini | 0 .../onboarding-ms}/env/dev/backend.tfvars | 0 .../onboarding-ms}/env/dev/terraform.tfvars | 0 .../onboarding-ms}/env/prod/backend.ini | 0 .../onboarding-ms}/env/prod/backend.tfvars | 0 .../onboarding-ms}/env/prod/terraform.tfvars | 0 .../onboarding-ms}/env/uat/backend.ini | 0 .../onboarding-ms}/env/uat/backend.tfvars | 0 .../onboarding-ms}/env/uat/terraform.tfvars | 0 .container_apps/onboarding-ms/locals.tf | 17 +++++++++ .../onboarding-ms}/main.tf | 0 .../onboarding-ms}/outputs.tf | 0 .../onboarding-ms}/terraform.sh | 0 .../onboarding-ms}/variables.tf | 0 .github/workflows/deploy_onboarding_ms.yml | 7 ++-- 18 files changed, 23 insertions(+), 41 deletions(-) delete mode 100644 .container_app/locals.tf rename {.container_app => .container_apps/onboarding-ms}/.terraform.lock.hcl (100%) rename {.container_app => .container_apps/onboarding-ms}/container_app.tf (94%) rename {.container_app => .container_apps/onboarding-ms}/env/dev/backend.ini (100%) rename {.container_app => .container_apps/onboarding-ms}/env/dev/backend.tfvars (100%) rename {.container_app => .container_apps/onboarding-ms}/env/dev/terraform.tfvars (100%) rename {.container_app => .container_apps/onboarding-ms}/env/prod/backend.ini (100%) rename {.container_app => .container_apps/onboarding-ms}/env/prod/backend.tfvars (100%) rename {.container_app => .container_apps/onboarding-ms}/env/prod/terraform.tfvars (100%) rename {.container_app => .container_apps/onboarding-ms}/env/uat/backend.ini (100%) rename {.container_app => .container_apps/onboarding-ms}/env/uat/backend.tfvars (100%) rename {.container_app => .container_apps/onboarding-ms}/env/uat/terraform.tfvars (100%) create mode 100644 .container_apps/onboarding-ms/locals.tf rename {.container_app => .container_apps/onboarding-ms}/main.tf (100%) rename {.container_app => .container_apps/onboarding-ms}/outputs.tf (100%) rename {.container_app => .container_apps/onboarding-ms}/terraform.sh (100%) rename {.container_app => .container_apps/onboarding-ms}/variables.tf (100%) diff --git a/.container_app/locals.tf b/.container_app/locals.tf deleted file mode 100644 index bcf8465e4..000000000 --- a/.container_app/locals.tf +++ /dev/null @@ -1,35 +0,0 @@ -locals { - project = "${var.prefix}-${var.env_short}" - app_name = "onboarding" - - secrets = [for secret in var.key_vault.secrets_names : - { - identity = "system" - name = "${secret}" - keyVaultUrl = data.azurerm_key_vault_secret.keyvault_secret["${secret}"].id - }] - - # secrets_env = [for secret in var.key_vault.secrets_names : - # { - # name = upper(secret) - # secretRef = secret - # }] - secrets_env = [ - { - name = "JWT_TOKEN_PUBLIC_KEY" - secretRef = "jwt-public-key" - }, - { - name = "MONGODB_CONNECTION_URI" - secretRef = "mongodb-connection-string" - }, - { - name = "USER_REGISTRY_API_KEY" - secretRef = "user-registry-api-key" - }, - { - name = "ONBOARDING_FUNCTIONS_API_KEY" - secretRef = "onboarding-functions-api-key" - }, - ] -} \ No newline at end of file diff --git a/.container_app/.terraform.lock.hcl b/.container_apps/onboarding-ms/.terraform.lock.hcl similarity index 100% rename from .container_app/.terraform.lock.hcl rename to .container_apps/onboarding-ms/.terraform.lock.hcl diff --git a/.container_app/container_app.tf b/.container_apps/onboarding-ms/container_app.tf similarity index 94% rename from .container_app/container_app.tf rename to .container_apps/onboarding-ms/container_app.tf index a2f32afe7..7a212a988 100644 --- a/.container_app/container_app.tf +++ b/.container_apps/onboarding-ms/container_app.tf @@ -22,7 +22,7 @@ data "azurerm_container_app_environment" "container_app_environment" { name = "${local.project}-cae" } -resource "azapi_resource" "container_app_onboarding" { +resource "azapi_resource" "container_app" { type = "Microsoft.App/containerApps@2023-05-01" name = "${local.project}-${local.app_name}-ca" location = data.azurerm_resource_group.resource_group_app.location @@ -46,7 +46,6 @@ resource "azapi_resource" "container_app_onboarding" { latestRevision = true label = "latest" weight = 100 - } ] targetPort = 8080 @@ -58,7 +57,7 @@ resource "azapi_resource" "container_app_onboarding" { containers = [ { env = concat(var.app_settings, local.secrets_env) - image = "ghcr.io/pagopa/selfcare-onboarding:${var.image_tag}" + image = "ghcr.io/pagopa/selfcare-onboarding-ms:${var.image_tag}" name = "${local.project}-${local.app_name}" resources = { cpu = var.container_app.cpu diff --git a/.container_app/env/dev/backend.ini b/.container_apps/onboarding-ms/env/dev/backend.ini similarity index 100% rename from .container_app/env/dev/backend.ini rename to .container_apps/onboarding-ms/env/dev/backend.ini diff --git a/.container_app/env/dev/backend.tfvars b/.container_apps/onboarding-ms/env/dev/backend.tfvars similarity index 100% rename from .container_app/env/dev/backend.tfvars rename to .container_apps/onboarding-ms/env/dev/backend.tfvars diff --git a/.container_app/env/dev/terraform.tfvars b/.container_apps/onboarding-ms/env/dev/terraform.tfvars similarity index 100% rename from .container_app/env/dev/terraform.tfvars rename to .container_apps/onboarding-ms/env/dev/terraform.tfvars diff --git a/.container_app/env/prod/backend.ini b/.container_apps/onboarding-ms/env/prod/backend.ini similarity index 100% rename from .container_app/env/prod/backend.ini rename to .container_apps/onboarding-ms/env/prod/backend.ini diff --git a/.container_app/env/prod/backend.tfvars b/.container_apps/onboarding-ms/env/prod/backend.tfvars similarity index 100% rename from .container_app/env/prod/backend.tfvars rename to .container_apps/onboarding-ms/env/prod/backend.tfvars diff --git a/.container_app/env/prod/terraform.tfvars b/.container_apps/onboarding-ms/env/prod/terraform.tfvars similarity index 100% rename from .container_app/env/prod/terraform.tfvars rename to .container_apps/onboarding-ms/env/prod/terraform.tfvars diff --git a/.container_app/env/uat/backend.ini b/.container_apps/onboarding-ms/env/uat/backend.ini similarity index 100% rename from .container_app/env/uat/backend.ini rename to .container_apps/onboarding-ms/env/uat/backend.ini diff --git a/.container_app/env/uat/backend.tfvars b/.container_apps/onboarding-ms/env/uat/backend.tfvars similarity index 100% rename from .container_app/env/uat/backend.tfvars rename to .container_apps/onboarding-ms/env/uat/backend.tfvars diff --git a/.container_app/env/uat/terraform.tfvars b/.container_apps/onboarding-ms/env/uat/terraform.tfvars similarity index 100% rename from .container_app/env/uat/terraform.tfvars rename to .container_apps/onboarding-ms/env/uat/terraform.tfvars diff --git a/.container_apps/onboarding-ms/locals.tf b/.container_apps/onboarding-ms/locals.tf new file mode 100644 index 000000000..780e06b56 --- /dev/null +++ b/.container_apps/onboarding-ms/locals.tf @@ -0,0 +1,17 @@ +locals { + project = "${var.prefix}-${var.env_short}" + app_name = "onboarding-ms" + + secrets = [for secret in var.key_vault.secrets_names : + { + identity = "system" + name = "${secret}" + keyVaultUrl = data.azurerm_key_vault_secret.keyvault_secret["${secret}"].id + }] + + secrets_env = [for secret in var.key_vault.secrets_names : + { + name = upper(secret) + secretRef = secret + }] +} \ No newline at end of file diff --git a/.container_app/main.tf b/.container_apps/onboarding-ms/main.tf similarity index 100% rename from .container_app/main.tf rename to .container_apps/onboarding-ms/main.tf diff --git a/.container_app/outputs.tf b/.container_apps/onboarding-ms/outputs.tf similarity index 100% rename from .container_app/outputs.tf rename to .container_apps/onboarding-ms/outputs.tf diff --git a/.container_app/terraform.sh b/.container_apps/onboarding-ms/terraform.sh similarity index 100% rename from .container_app/terraform.sh rename to .container_apps/onboarding-ms/terraform.sh diff --git a/.container_app/variables.tf b/.container_apps/onboarding-ms/variables.tf similarity index 100% rename from .container_app/variables.tf rename to .container_apps/onboarding-ms/variables.tf diff --git a/.github/workflows/deploy_onboarding_ms.yml b/.github/workflows/deploy_onboarding_ms.yml index 232f17169..b058ae1eb 100644 --- a/.github/workflows/deploy_onboarding_ms.yml +++ b/.github/workflows/deploy_onboarding_ms.yml @@ -22,7 +22,7 @@ on: - prod env: - DIR: "./.container_app" + DIR: "./.container_apps/onboarding-ms" # This condition (that unfortunately must be replicated for the first job) # sets the environment depending on the current context for manually # started workflows, it picks up the value coming from the UI; otherwise, @@ -80,12 +80,13 @@ jobs: id: meta uses: docker/metadata-action@v4.3.0 with: - images: ghcr.io/${{ github.repository }} + images: ghcr.io/${{ github.repository }}-ms tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch type=sha - labels: org.opencontainers.image.title=${{ github.repository }} + labels: + org.opencontainers.image.title=${{ github.repository }}-ms org.opencontainers.image.description=SelfCare onboarding microservice org.opencontainers.image.authors=PagoPA org.opencontainers.image.url=github.com/pagopa/${{ github.repository }}