-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostgresdb.tf
56 lines (48 loc) · 1.68 KB
/
postgresdb.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
module "postgresql_flexible" {
providers = {
azurerm.postgres_network = azurerm.postgres_network
}
source = "git@github.com:hmcts/terraform-module-postgresql-flexible?ref=master"
env = var.env
product = var.product
name = "${var.product}-${local.platform}-flexible"
component = ""
business_area = local.platform
location = var.location
subnet_suffix = "expanded"
resource_group_name = azurerm_resource_group.shared_resource_group.name
common_tags = var.common_tags
admin_user_object_id = var.jenkins_AAD_objectId
pgsql_databases = [
{
name : "recipes"
}
]
pgsql_version = "16"
pgsql_sku = var.pgsql_sku
}
resource "azurerm_key_vault_secret" "POSTGRES-USER" {
name = "recipes-backend-POSTGRES-USER"
value = module.postgresql_flexible.username
key_vault_id = module.vault.key_vault_id
}
resource "azurerm_key_vault_secret" "POSTGRES-PASS" {
name = "recipes-backend-POSTGRES-PASS"
value = module.postgresql_flexible.password
key_vault_id = module.vault.key_vault_id
}
resource "azurerm_key_vault_secret" "POSTGRES_HOST" {
name = "recipes-backend-POSTGRES-HOST"
value = module.postgresql_flexible.fqdn
key_vault_id = module.vault.key_vault_id
}
resource "azurerm_key_vault_secret" "POSTGRES_PORT" {
name = "recipes-backend-POSTGRES-PORT"
value = "5432"
key_vault_id = module.vault.key_vault_id
}
resource "azurerm_key_vault_secret" "POSTGRES_DATABASE" {
name = "recipes-backend-POSTGRES-DATABASE"
value = "recipes"
key_vault_id = module.vault.key_vault_id
}