34 lines
736 B
HCL
34 lines
736 B
HCL
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
|
|
}
|