dayrize-usecase/terraform/modules/postgresql/main.tf

34 lines
736 B
Terraform
Raw Normal View History

2023-06-23 15:20:40 +02:00
terraform {
required_providers {
postgresql = {
source = "cyrilgdn/postgresql"
version = ">= 1.19.0"
}
}
}
provider "postgresql" {
host = var.host
port = var.port
username = var.username
password = var.password
sslmode = "disable"
}
resource "postgresql_role" "pg_pipeline_user" {
name = var.pipeline_username
password = var.pipeline_password
login = true
}
resource "postgresql_database" "pg_pipeline_db" {
name = var.pipeline_db
owner = postgresql_role.pg_pipeline_user.name
}
resource "postgresql_schema" "pg_pipeline_schema" {
name = var.pipeline_schema
database = postgresql_database.pg_pipeline_db.name
owner = postgresql_role.pg_pipeline_user.name
}