Skip to content

Commit b1ccb48

Browse files
author
Cyril Gaudin
authored
Merge pull request #2 from edgelaboratories/template
Allow to configure the database template
2 parents 2bbedef + 7f95353 commit b1ccb48

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

database.tf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ resource "postgresql_database" "this" {
1515
name = var.database
1616
owner = postgresql_role.owner.name
1717

18-
# CREATE DATABASE uses template1 by default, but the Terraform provider uses template0.
19-
# In RDS, the owner of the schema 'public' is 'postgres' in template1, so we can manage owner of tables
20-
# but 'rdsadmin' in template0 so we don't have all the permissions.
21-
template = "template1"
18+
template = var.template
2219

2320
lc_collate = var.lc_collate
2421
lc_ctype = coalesce(var.lc_ctype, var.lc_collate)

variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ variable "database" {
22
description = "The name of the database"
33
}
44

5+
variable "template" {
6+
# CREATE DATABASE uses template1 by default, but the Terraform provider uses template0.
7+
# In RDS, the owner of the schema 'public' is 'postgres' in template1, so we can manage owner of tables
8+
# but 'rdsadmin' in template0 so we don't have all the permissions.
9+
default = "template1"
10+
}
11+
512
variable "schemas" {
613
description = "The schemas to create"
714
default = ["public"]

0 commit comments

Comments
 (0)