diff --git a/.github/workflows/pr_ms.yml b/.github/workflows/pr_ms.yml index 7cd022e..b4051a9 100644 --- a/.github/workflows/pr_ms.yml +++ b/.github/workflows/pr_ms.yml @@ -3,21 +3,15 @@ on: workflow_dispatch: pull_request: + branches: + - main + - releases/** types: + - opened + - edited - synchronize - reopened - ready_for_review - paths: - - '.github/workflows/pr_ms.yml' - - '.github/workflows/release_ms.yml' - - '.github/workflows/release_ms_pnpg.yml' - - '!.devops/**' - - '!helm/**' - - '!**.md' - - '!**ignore' - - '!infra/**' - - '!.terraform-version' - - '!CODEOWNERS' jobs: diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 3dad7fe..5ddf149 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -1,4 +1,4 @@ -replicaCount: 2 +replicaCount: 0 image: repository: selcdacr.azurecr.io/selfcaremsproduct diff --git a/infra/container_apps/README.md b/infra/container_apps/README.md index 43cca76..a5ba689 100644 --- a/infra/container_apps/README.md +++ b/infra/container_apps/README.md @@ -18,7 +18,7 @@ No providers. | Name | Source | Version | |------|--------|---------| -| [container\_app\_dashboard\_backend](#module\_container\_app\_dashboard\_backend) | github.com/pagopa/selfcare-commons//infra/terraform-modules/container_app_microservice | main | +| [container\_app\_ms\_product](#module\_container\_app\_ms\_product) | github.com/pagopa/selfcare-commons//infra/terraform-modules/container_app_microservice | main | ## Resources @@ -29,12 +29,14 @@ No resources. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [app\_settings](#input\_app\_settings) | n/a |
list(object({| n/a | yes | +| [cae\_name](#input\_cae\_name) | Container App Environment name | `string` | `"cae-cp"` | no | | [container\_app](#input\_container\_app) | Container App configuration |
name = string
value = string
}))
object({| n/a | yes | | [env\_short](#input\_env\_short) | Environment short name | `string` | n/a | yes | | [image\_tag](#input\_image\_tag) | Image tag to use for the container | `string` | `"latest"` | no | | [is\_pnpg](#input\_is\_pnpg) | (Optional) True if you want to apply changes to PNPG environment | `bool` | `false` | no | -| [secrets\_names](#input\_secrets\_names) | KeyVault secrets to get values from | `list(string)` | n/a | yes | +| [secrets\_names](#input\_secrets\_names) | KeyVault secrets to get values from | `map(string)` | n/a | yes | | [tags](#input\_tags) | n/a | `map(any)` | n/a | yes | +| [workload\_profile\_name](#input\_workload\_profile\_name) | Workload Profile name to use | `string` | `null` | no | ## Outputs diff --git a/infra/container_apps/env/dev-pnpg/terraform.tfvars b/infra/container_apps/env/dev-pnpg/terraform.tfvars index 098c015..780c635 100644 --- a/infra/container_apps/env/dev-pnpg/terraform.tfvars +++ b/infra/container_apps/env/dev-pnpg/terraform.tfvars @@ -26,8 +26,8 @@ container_app = { name = "cron-scale-rule" } ] - cpu = 0.5 - memory = "1Gi" + cpu = 0.5 + memory = "1Gi" } app_settings = [ @@ -49,17 +49,17 @@ app_settings = [ }, { name = "DEPICT_IMAGE_URL" - value = "" + value = "" }, { - name = "BLOBSTORAGE_PUBLIC_HOST" + name = "BLOBSTORAGE_PUBLIC_HOST" value = "selcdweupnpgcheckoutsa.z6.web.core.windows.net" } ] secrets_names = { - "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" - "MONGODB_CONNECTION_URI" = "mongodb-connection-string" - "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" - "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" + "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" + "MONGODB_CONNECTION_URI" = "mongodb-connection-string" + "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" + "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" } diff --git a/infra/container_apps/env/dev/terraform.tfvars b/infra/container_apps/env/dev/terraform.tfvars index f052362..50d52b3 100644 --- a/infra/container_apps/env/dev/terraform.tfvars +++ b/infra/container_apps/env/dev/terraform.tfvars @@ -25,8 +25,8 @@ container_app = { name = "cron-scale-rule" } ] - cpu = 0.5 - memory = "1Gi" + cpu = 0.5 + memory = "1Gi" } app_settings = [ @@ -48,17 +48,17 @@ app_settings = [ }, { name = "DEPICT_IMAGE_URL" - value = "https://selcdcheckoutsa.z6.web.core.windows.net/resources/products/default/depict-image.jpeg" + value = "https://selcdcheckoutsa.z6.web.core.windows.net/resources/products/default/depict-image.jpeg" }, { - name = "BLOBSTORAGE_PUBLIC_HOST" + name = "BLOBSTORAGE_PUBLIC_HOST" value = "selcdcheckoutsa.z6.web.core.windows.net" } ] secrets_names = { - "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" - "MONGODB_CONNECTION_URI" = "mongodb-connection-string" - "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" - "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" + "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" + "MONGODB_CONNECTION_URI" = "mongodb-connection-string" + "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" + "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" } diff --git a/infra/container_apps/env/prod-pnpg/terraform.tfvars b/infra/container_apps/env/prod-pnpg/terraform.tfvars index dcae363..0da0eb4 100644 --- a/infra/container_apps/env/prod-pnpg/terraform.tfvars +++ b/infra/container_apps/env/prod-pnpg/terraform.tfvars @@ -49,17 +49,17 @@ app_settings = [ }, { name = "DEPICT_IMAGE_URL" - value = "" + value = "" }, { - name = "BLOBSTORAGE_PUBLIC_HOST" + name = "BLOBSTORAGE_PUBLIC_HOST" value = "selcpweupnpgcheckoutsa.z6.web.core.windows.net" } ] secrets_names = { - "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" - "MONGODB_CONNECTION_URI" = "mongodb-connection-string" - "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" - "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" + "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" + "MONGODB_CONNECTION_URI" = "mongodb-connection-string" + "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" + "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" } \ No newline at end of file diff --git a/infra/container_apps/env/prod/terraform.tfvars b/infra/container_apps/env/prod/terraform.tfvars index 33d404f..3b8b8ee 100644 --- a/infra/container_apps/env/prod/terraform.tfvars +++ b/infra/container_apps/env/prod/terraform.tfvars @@ -50,17 +50,17 @@ app_settings = [ }, { name = "DEPICT_IMAGE_URL" - value = "https://selcpcheckoutsa.z6.web.core.windows.net/resources/products/default/depict-image.jpeg" + value = "https://selcpcheckoutsa.z6.web.core.windows.net/resources/products/default/depict-image.jpeg" }, { - name = "BLOBSTORAGE_PUBLIC_HOST" + name = "BLOBSTORAGE_PUBLIC_HOST" value = "selcpcheckoutsa.z6.web.core.windows.net" } ] secrets_names = { - "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" - "MONGODB_CONNECTION_URI" = "mongodb-connection-string" - "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" - "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" + "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" + "MONGODB_CONNECTION_URI" = "mongodb-connection-string" + "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" + "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" } \ No newline at end of file diff --git a/infra/container_apps/env/uat-pnpg/terraform.tfvars b/infra/container_apps/env/uat-pnpg/terraform.tfvars index 6fc0cb8..14bf5f1 100644 --- a/infra/container_apps/env/uat-pnpg/terraform.tfvars +++ b/infra/container_apps/env/uat-pnpg/terraform.tfvars @@ -1,5 +1,7 @@ -is_pnpg = true -env_short = "u" +is_pnpg = true +env_short = "u" +cae_name = "cae" +workload_profile_name = "Consumption" tags = { CreatedBy = "Terraform" @@ -36,17 +38,17 @@ app_settings = [ }, { name = "DEPICT_IMAGE_URL" - value = "" + value = "" }, { - name = "BLOBSTORAGE_PUBLIC_HOST" + name = "BLOBSTORAGE_PUBLIC_HOST" value = "selcuweupnpgcheckoutsa.z6.web.core.windows.net" } ] secrets_names = { - "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" - "MONGODB_CONNECTION_URI" = "mongodb-connection-string" - "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" - "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" + "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" + "MONGODB_CONNECTION_URI" = "mongodb-connection-string" + "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" + "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" } diff --git a/infra/container_apps/env/uat/terraform.tfvars b/infra/container_apps/env/uat/terraform.tfvars index cee883d..c36d35f 100644 --- a/infra/container_apps/env/uat/terraform.tfvars +++ b/infra/container_apps/env/uat/terraform.tfvars @@ -1,4 +1,6 @@ -env_short = "u" +env_short = "u" +cae_name = "cae" +workload_profile_name = "Consumption" tags = { CreatedBy = "Terraform" @@ -37,17 +39,17 @@ app_settings = [ }, { name = "DEPICT_IMAGE_URL" - value = "https://selcucheckoutsa.z6.web.core.windows.net/resources/products/default/depict-image.jpeg" + value = "https://selcucheckoutsa.z6.web.core.windows.net/resources/products/default/depict-image.jpeg" }, { - name = "BLOBSTORAGE_PUBLIC_HOST" + name = "BLOBSTORAGE_PUBLIC_HOST" value = "selcucheckoutsa.z6.web.core.windows.net" } ] secrets_names = { - "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" - "MONGODB_CONNECTION_URI" = "mongodb-connection-string" - "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" - "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" + "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" + "MONGODB_CONNECTION_URI" = "mongodb-connection-string" + "BLOB_STORAGE_CONN_STRING" = "blob-storage-product-connection-string" + "APPLICATIONINSIGHTS_CONNECTION_STRING" = "appinsights-connection-string" } diff --git a/infra/container_apps/locals.tf b/infra/container_apps/locals.tf new file mode 100644 index 0000000..919eaef --- /dev/null +++ b/infra/container_apps/locals.tf @@ -0,0 +1,6 @@ +locals { + pnpg_suffix = var.is_pnpg == true ? "-pnpg" : "" + project = "selc-${var.env_short}" + + container_app_environment_name = "${local.project}${local.pnpg_suffix}-${var.cae_name}" +} \ No newline at end of file diff --git a/infra/container_apps/main.tf b/infra/container_apps/main.tf index efb38a4..14bbe91 100644 --- a/infra/container_apps/main.tf +++ b/infra/container_apps/main.tf @@ -13,13 +13,15 @@ module "container_app_ms_product" { is_pnpg = var.is_pnpg - env_short = var.env_short - container_app = var.container_app - container_app_name = "product" - image_name = "selfcare-ms-product" - image_tag = var.image_tag - app_settings = var.app_settings - secrets_names = var.secrets_names + env_short = var.env_short + container_app = var.container_app + container_app_name = "product" + container_app_environment_name = local.container_app_environment_name + image_name = "selfcare-ms-product" + image_tag = var.image_tag + app_settings = var.app_settings + secrets_names = var.secrets_names + workload_profile_name = var.workload_profile_name tags = var.tags } diff --git a/infra/container_apps/variables.tf b/infra/container_apps/variables.tf index b9baf16..5d47c53 100644 --- a/infra/container_apps/variables.tf +++ b/infra/container_apps/variables.tf @@ -55,3 +55,15 @@ variable "secrets_names" { type = map(string) description = "KeyVault secrets to get values from" } + +variable "workload_profile_name" { + type = string + description = "Workload Profile name to use" + default = null +} + +variable "cae_name" { + type = string + description = "Container App Environment name" + default = "cae-cp" +}
min_replicas = number
max_replicas = number
scale_rules = list(object({
name = string
custom = object({
metadata = map(string)
type = string
})
}))
cpu = number
memory = string
})