Skip to content

Commit

Permalink
chore: Migration to Container App module with name and workload_profi…
Browse files Browse the repository at this point in the history
…le empty (#164)
  • Loading branch information
manuraf authored Apr 10, 2024
1 parent c39485b commit 814dd99
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 64 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/pr_ms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion helm/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
replicaCount: 2
replicaCount: 0

image:
repository: selcdacr.azurecr.io/selfcaremsproduct
Expand Down
6 changes: 4 additions & 2 deletions infra/container_apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ No providers.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_container_app_dashboard_backend"></a> [container\_app\_dashboard\_backend](#module\_container\_app\_dashboard\_backend) | github.com/pagopa/selfcare-commons//infra/terraform-modules/container_app_microservice | main |
| <a name="module_container_app_ms_product"></a> [container\_app\_ms\_product](#module\_container\_app\_ms\_product) | github.com/pagopa/selfcare-commons//infra/terraform-modules/container_app_microservice | main |

## Resources

Expand All @@ -29,12 +29,14 @@ No resources.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_app_settings"></a> [app\_settings](#input\_app\_settings) | n/a | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | n/a | yes |
| <a name="input_cae_name"></a> [cae\_name](#input\_cae\_name) | Container App Environment name | `string` | `"cae-cp"` | no |
| <a name="input_container_app"></a> [container\_app](#input\_container\_app) | Container App configuration | <pre>object({<br> min_replicas = number<br> max_replicas = number<br><br> scale_rules = list(object({<br> name = string<br> custom = object({<br> metadata = map(string)<br> type = string<br> })<br> }))<br><br> cpu = number<br> memory = string<br> })</pre> | n/a | yes |
| <a name="input_env_short"></a> [env\_short](#input\_env\_short) | Environment short name | `string` | n/a | yes |
| <a name="input_image_tag"></a> [image\_tag](#input\_image\_tag) | Image tag to use for the container | `string` | `"latest"` | no |
| <a name="input_is_pnpg"></a> [is\_pnpg](#input\_is\_pnpg) | (Optional) True if you want to apply changes to PNPG environment | `bool` | `false` | no |
| <a name="input_secrets_names"></a> [secrets\_names](#input\_secrets\_names) | KeyVault secrets to get values from | `list(string)` | n/a | yes |
| <a name="input_secrets_names"></a> [secrets\_names](#input\_secrets\_names) | KeyVault secrets to get values from | `map(string)` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map(any)` | n/a | yes |
| <a name="input_workload_profile_name"></a> [workload\_profile\_name](#input\_workload\_profile\_name) | Workload Profile name to use | `string` | `null` | no |

## Outputs

Expand Down
16 changes: 8 additions & 8 deletions infra/container_apps/env/dev-pnpg/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ container_app = {
name = "cron-scale-rule"
}
]
cpu = 0.5
memory = "1Gi"
cpu = 0.5
memory = "1Gi"
}

app_settings = [
Expand All @@ -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"
}
16 changes: 8 additions & 8 deletions infra/container_apps/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ container_app = {
name = "cron-scale-rule"
}
]
cpu = 0.5
memory = "1Gi"
cpu = 0.5
memory = "1Gi"
}

app_settings = [
Expand All @@ -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"
}
12 changes: 6 additions & 6 deletions infra/container_apps/env/prod-pnpg/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
12 changes: 6 additions & 6 deletions infra/container_apps/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
18 changes: 10 additions & 8 deletions infra/container_apps/env/uat-pnpg/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"
}
16 changes: 9 additions & 7 deletions infra/container_apps/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
env_short = "u"
env_short = "u"
cae_name = "cae"
workload_profile_name = "Consumption"

tags = {
CreatedBy = "Terraform"
Expand Down Expand Up @@ -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"
}
6 changes: 6 additions & 0 deletions infra/container_apps/locals.tf
Original file line number Diff line number Diff line change
@@ -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}"
}
16 changes: 9 additions & 7 deletions infra/container_apps/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
12 changes: 12 additions & 0 deletions infra/container_apps/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 814dd99

Please sign in to comment.