Move terraform files into modules
This commit is contained in:
parent
4e495dbc51
commit
bae9fe9e0f
14 changed files with 286 additions and 104 deletions
modules/services
18
modules/services/postgresql.tf
Normal file
18
modules/services/postgresql.tf
Normal file
|
@ -0,0 +1,18 @@
|
|||
resource "random_password" "postgresql_service_passwords" {
|
||||
for_each = local.services_database
|
||||
length = 32
|
||||
special = false
|
||||
}
|
||||
|
||||
resource "postgresql_role" "service_roles" {
|
||||
for_each = local.services_database
|
||||
name = each.value.name
|
||||
login = true
|
||||
password = random_password.postgresql_service_passwords[each.key].result
|
||||
}
|
||||
|
||||
resource "postgresql_database" "service_databases" {
|
||||
for_each = local.services_database
|
||||
name = each.value.name
|
||||
owner = postgresql_role.service_roles[each.key].name
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue