Skip to content

Commit

Permalink
migrate cms to new db
Browse files Browse the repository at this point in the history
  • Loading branch information
kahlstrm committed Nov 7, 2023
1 parent 44d90e6 commit aab5883
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
11 changes: 5 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ module "cms" {
env_name = "prod"
resource_group_name = module.common.resource_group_name
resource_group_location = local.resource_group_location
postgres_server_name = module.common.postgres_server_name
postgres_server_fqdn = module.common.postgres_server_fqdn
postgres_server_host = module.common.postgres_server_host
postgres_server_name = module.common.postgres_server_new_name
postgres_server_fqdn = module.common.postgres_server_new_fqdn
postgres_server_id = module.common.postgres_server_new_id
postgres_admin_password = module.common.postgres_admin_password
strapi_jwt_secret = module.keyvault.strapi_jwt_secret
strapi_admin_jwt_secret = module.keyvault.strapi_admin_jwt_secret
Expand All @@ -148,7 +148,6 @@ module "cms" {
tikweb_app_plan_id = module.common.tikweb_app_plan_id
tikweb_rg_location = module.common.resource_group_location
tikweb_rg_name = module.common.resource_group_name
postgres_server_new_id = module.common.postgres_server_new_id
}

module "ilmo" {
Expand All @@ -158,7 +157,7 @@ module "ilmo" {
resource_group_location = local.resource_group_location
postgres_server_name = module.common.postgres_server_name
postgres_server_fqdn = module.common.postgres_server_fqdn
postgres_server_host = module.common.postgres_server_host
postgres_server_host = module.common.postgres_server_name
postgres_admin_password = module.common.postgres_admin_password
postgres_server_new_id = module.common.postgres_server_new_id
edit_token_secret = module.keyvault.ilmo_edit_token_secret
Expand Down Expand Up @@ -194,7 +193,7 @@ module "tenttiarkisto" {
resource_group_location = local.resource_group_location
postgres_server_name = module.common.postgres_server_name
postgres_server_fqdn = module.common.postgres_server_fqdn
postgres_server_host = module.common.postgres_server_host
postgres_server_host = module.common.postgres_server_name
postgres_admin_password = module.common.postgres_admin_password
postgres_server_new_id = module.common.postgres_server_new_id
tikweb_app_plan_id = module.common.tikweb_app_plan_id
Expand Down
4 changes: 2 additions & 2 deletions modules/cms/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resource "azurerm_postgresql_database" "tikweb_cms_db" {

resource "azurerm_postgresql_flexible_server_database" "tikweb_cms_db_new" {
name = local.db_name
server_id = var.postgres_server_new_id
server_id = var.postgres_server_id
charset = "utf8"
}

Expand Down Expand Up @@ -54,7 +54,7 @@ resource "azurerm_linux_web_app" "tikweb_cms" {
DATABASE_HOST = var.postgres_server_fqdn
DATABASE_PORT = 5432
DATABASE_NAME = local.db_name
DATABASE_USERNAME = "tietokilta@${var.postgres_server_host}"
DATABASE_USERNAME = "tietokilta"
DATABASE_PASSWORD = var.postgres_admin_password
DATABASE_SSL = true
ADMIN_JWT_SECRET = var.strapi_admin_jwt_secret
Expand Down
6 changes: 1 addition & 5 deletions modules/cms/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ variable "postgres_server_fqdn" {
type = string
}

variable "postgres_server_new_id" {
variable "postgres_server_id" {
type = string
}
variable "postgres_admin_password" {
Expand All @@ -45,10 +45,6 @@ variable "strapi_app_keys" {
sensitive = true
}

variable "postgres_server_host" {
type = string
}

variable "github_app_key" {
type = string
}
Expand Down
11 changes: 7 additions & 4 deletions modules/common/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ output "postgres_server_fqdn" {
value = azurerm_postgresql_server.tikweb_pg.fqdn
}

output "postgres_server_host" {
value = azurerm_postgresql_server.tikweb_pg.name
}

output "postgres_admin_password" {
value = azurerm_postgresql_server.tikweb_pg.administrator_login_password
sensitive = true
Expand All @@ -29,6 +25,13 @@ output "postgres_admin_username" {
output "postgres_server_new_id" {
value = azurerm_postgresql_flexible_server.tikweb_pg_new.id
}

output "postgres_server_new_fqdn" {
value = azurerm_postgresql_flexible_server.tikweb_pg_new.fqdn
}
output "postgres_server_new_name" {
value = azurerm_postgresql_flexible_server.tikweb_pg_new.name
}
output "tikweb_app_plan_id" {
value = azurerm_service_plan.tikweb_plan.id
}
Expand Down

0 comments on commit aab5883

Please sign in to comment.