Skip to content

Commit

Permalink
environments setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 committed Oct 26, 2023
1 parent c06bf9b commit 412a9c0
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .container_app/container_app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ resource "azapi_resource" "container_app_onboarding" {
template = {
containers = [
{
env = concat(var.container_app.app_settings, local.secrets_env)
env = concat(var.app_settings, local.secrets_env)
image = "ghcr.io/pagopa/selfcare-onboarding:${var.image_tag}"
name = "${local.project}-${local.app_name}"
resources = {
Expand Down
30 changes: 15 additions & 15 deletions .container_app/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ tags = {
}

container_app = {
image_tag = "sha-384dd82"
min_replicas = 0
max_replicas = 1
scale_rules = []
app_settings = [
{
name = "USER_REGISTRY_URL"
value = "https://api.uat.pdv.pagopa.it/user-registry/v1"
},
{
name = "ONBOARDING_FUNCTIONS_URL"
value = "https://selc-d-func.azurewebsites.net"
},
{
name = "ONBOARDING_ALLOWED_INSTITUTIONS_PRODUCTS"
value = "{'prod-interop': ['*'], 'prod-pn': ['*'], 'prod-io': ['*'], 'prod-io-premium': ['*'], 'prod-pagopa': ['*'], 'prod-fd': ['*'], 'prod-fd-garantito': ['*']}"
}
]
cpu = 0.5
memory = "1Gi"
}

app_settings = [
{
name = "USER_REGISTRY_URL"
value = "https://api.uat.pdv.pagopa.it/user-registry/v1"
},
{
name = "ONBOARDING_FUNCTIONS_URL"
value = "https://selc-d-func.azurewebsites.net"
},
{
name = "ONBOARDING_ALLOWED_INSTITUTIONS_PRODUCTS"
value = "{'prod-interop': ['*'], 'prod-pn': ['*'], 'prod-io': ['*'], 'prod-io-premium': ['*'], 'prod-pagopa': ['*'], 'prod-fd': ['*'], 'prod-fd-garantito': ['*']}"
}
]

key_vault = {
resource_group_name = "selc-d-sec-rg"
name = "selc-d-kv"
Expand Down
1 change: 1 addition & 0 deletions .container_app/env/prod/backend.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subscription=PROD-SelfCare
4 changes: 4 additions & 0 deletions .container_app/env/prod/backend.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource_group_name = "terraform-state-rg"
storage_account_name = "tfappprodselfcare"
container_name = "terraform-state"
key = "onboarding-app.tfstate"
57 changes: 57 additions & 0 deletions .container_app/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
prefix = "selc"
env_short = "p"

tags = {
CreatedBy = "Terraform"
Environment = "Prod"
Owner = "SelfCare"
Source = "https://github.com/pagopa/selfcare-onboarding"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}

container_app = {
min_replicas = 0
max_replicas = 5
scale_rules = [
{
custom = {
metadata = {
"desiredReplicas" = "3"
"start" = "0 8 * * MON-FRI"
"end" = "0 19 * * MON-FRI"
"timezone" = "Europe/Rome"
}
type = "cron"
}
name = "cron-scale-rule"
}
]
cpu = 1.25
memory = "2.5Gi"
}

app_settings = [
{
name = "USER_REGISTRY_URL"
value = "https://api.uat.pdv.pagopa.it/user-registry/v1"
},
{
name = "ONBOARDING_FUNCTIONS_URL"
value = "https://selc-p-func.azurewebsites.net"
},
{
name = "ONBOARDING_ALLOWED_INSTITUTIONS_PRODUCTS"
value = "{'prod-interop': ['*'], 'prod-pn': ['*'], 'prod-io': ['*'], 'prod-io-premium': ['*'], 'prod-pagopa': ['*'], 'prod-fd': ['*'], 'prod-fd-garantito': ['*']}"
}
]

key_vault = {
resource_group_name = "selc-p-sec-rg"
name = "selc-p-kv"
secrets_names = [
"jwt-public-key",
"mongodb-connection-string",
"user-registry-api-key",
"onboarding-functions-api-key"
]
}
1 change: 1 addition & 0 deletions .container_app/env/uat/backend.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subscription=UAT-SelfCare
4 changes: 4 additions & 0 deletions .container_app/env/uat/backend.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource_group_name = "terraform-state-rg"
storage_account_name = "tfappuatselfcare"
container_name = "terraform-state"
key = "onboarding-app.tfstate"
44 changes: 44 additions & 0 deletions .container_app/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
prefix = "selc"
env_short = "u"

tags = {
CreatedBy = "Terraform"
Environment = "Uat"
Owner = "SelfCare"
Source = "https://github.com/pagopa/selfcare-onboarding"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}

container_app = {
min_replicas = 0
max_replicas = 2
scale_rules = []
cpu = 0.5
memory = "1Gi"
}

app_settings = [
{
name = "USER_REGISTRY_URL"
value = "https://api.uat.pdv.pagopa.it/user-registry/v1"
},
{
name = "ONBOARDING_FUNCTIONS_URL"
value = "https://selc-u-func.azurewebsites.net"
},
{
name = "ONBOARDING_ALLOWED_INSTITUTIONS_PRODUCTS"
value = "{'prod-interop': ['*'], 'prod-pn': ['*'], 'prod-io': ['*'], 'prod-io-premium': ['*'], 'prod-pagopa': ['*'], 'prod-fd': ['*'], 'prod-fd-garantito': ['*']}"
}
]

key_vault = {
resource_group_name = "selc-u-sec-rg"
name = "selc-u-kv"
secrets_names = [
"jwt-public-key",
"mongodb-connection-string",
"user-registry-api-key",
"onboarding-functions-api-key"
]
}
28 changes: 8 additions & 20 deletions .container_app/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ variable "tags" {
variable "container_app" {
description = "Container App configuration"
type = object({
image_tag = string
min_replicas = number
max_replicas = number

Expand All @@ -42,32 +41,21 @@ variable "container_app" {

cpu = number
memory = string

app_settings = list(object({
name = string
value = string
}))
})

default = {
image_tag = "latest"
min_replicas = 0
max_replicas = 1

scale_rules = []
app_settings = []
env = []

cpu = 0.5
memory = "1Gi"
}
}

variable "image_tag" {
type = string
type = string
default = "latest"
}

variable "app_settings" {
type = list(object({
name = string
value = string
}))
}

variable "key_vault" {
description = "KeyVault data to get secrets values from"
type = object({
Expand Down

0 comments on commit 412a9c0

Please sign in to comment.