postgres-provisionning/main.tf

108 lines
2.5 KiB
HCL

terraform {
required_version = ">= 1.0.4, < 2.0.0"
required_providers {
postgresql = {
source = "cyrilgdn/postgresql"
version = ">= 1.21.0"
}
}
backend "s3" {
endpoints = {
s3 = "http://s3.localdomain"
}
key = "postgres.tfstate"
bucket = "terraform"
region = "FR"
skip_credentials_validation = true
skip_requesting_account_id = true
skip_region_validation = true
skip_metadata_api_check = true
shared_credentials_files = ["~/.aws/credentials"]
profile = "minio"
use_path_style = true
}
}
provider "postgresql" {
host = "database.localdomain"
port = 5432
database = var.postgres.db
username = var.postgres.user
password = var.postgres.secret
sslmode = "disable"
connect_timeout = 15
}
module "ampere" {
source = "./generic-database"
database_name = "ampere"
username = "ampere_user"
}
module "cfssl" {
source = "./generic-database"
database_name = "cfssl"
username = "cfssl"
collate = "en_US.utf8"
ctype = "en_US.utf8"
}
module "gitea" {
source = "./generic-database"
database_name = "gitea_db"
username = "gitea"
collate = "fr_FR.UTF-8"
ctype = "fr_FR.UTF-8"
privileges = ["CREATE", "CONNECT", "TEMPORARY"]
}
module "keycloak" {
source = "./generic-database"
database_name = "keycloak"
username = "keycloak"
collate = "fr_FR.utf8"
ctype = "fr_FR.utf8"
privileges = ["CREATE", "CONNECT", "TEMPORARY"]
}
module "nextcloud" {
source = "./generic-database"
database_name = "nextcloud"
username = "nextcloud"
collate = "fr_FR.utf8"
ctype = "fr_FR.utf8"
privileges = ["CREATE", "CONNECT", "TEMPORARY"]
}
module "favorite_link" {
source = "./generic-database"
database_name = "favorite-link"
username = "favorite-link"
}
output "ampere_account" {
value = module.ampere.account
sensitive = true
}
output "cfssl_account" {
value = module.cfssl.account
sensitive = true
}
output "gitea_account" {
value = module.gitea.account
sensitive = true
}
output "keycloak_account" {
value = module.keycloak.account
sensitive = true
}
output "nextcloud_account" {
value = module.nextcloud.account
sensitive = true
}
output "favorite_link_account" {
value = module.favorite_link.account
sensitive = true
}