-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Weyder Ferreira
committed
Jul 27, 2022
1 parent
b5d2eaa
commit aaa4b11
Showing
6 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
resource "postgresql_role" "role" { | ||
name = var.name | ||
login = var.login | ||
password = var.password | ||
create_database = var.create_database | ||
create_role = var.create_role | ||
roles = var.roles | ||
|
||
lifecycle { | ||
prevent_destroy = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "name" { | ||
value = postgresql_role.role.name | ||
} | ||
|
||
output "id" { | ||
value = postgresql_role.role.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
variable name { | ||
type = string | ||
description = "(Required) The name of the role. Must be unique on the PostgreSQL server instance where it is configured." | ||
} | ||
|
||
variable login { | ||
type = bool | ||
default = false | ||
description = "(Optional) Defines whether role is allowed to log in. Roles without this attribute are useful for managing database privileges, but are not users in the usual sense of the word. Default value is false" | ||
} | ||
|
||
variable password { | ||
type = string | ||
description = "(Optional) Sets the role's password. A password is only of use for roles having the login attribute set to true." | ||
} | ||
|
||
variable create_database { | ||
type = bool | ||
default = false | ||
description = "(Optional) Defines a role's ability to execute CREATE DATABASE. Default value is false." | ||
} | ||
|
||
variable create_role { | ||
type = bool | ||
default = false | ||
description = "(Optional) Defines a role's ability to execute CREATE ROLE. A role with this privilege can also alter and drop other roles. Default value is false." | ||
} | ||
|
||
variable roles { | ||
type = list | ||
description = "(Optional) Defines list of roles which will be granted to this new role." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource "postgresql_schema" "schema" { | ||
name = var.name | ||
database = var.database | ||
owner = var.owner | ||
drop_cascade = var.drop_cascade | ||
if_not_exists = var.if_not_exists | ||
|
||
lifecycle { | ||
prevent_destroy = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "name" { | ||
value = postgresql_schema.schema.name | ||
description = "The name of Schema" | ||
} | ||
|
||
output "owner" { | ||
value = postgresql_schema.schema.owner | ||
description = "The owner of Schema" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
variable name { | ||
type = string | ||
description = "(Required) The name of the schema. Must be unique in the PostgreSQL database instance where it is configured." | ||
} | ||
|
||
variable database { | ||
type = string | ||
description = "(Optional) The DATABASE in which where this schema will be created. " | ||
} | ||
|
||
variable owner { | ||
type = string | ||
description = "(Optional) The ROLE who owns the schema." | ||
} | ||
|
||
variable drop_cascade { | ||
type = bool | ||
default = false | ||
description = "(Optional) When true, will also drop all the objects that are contained in the schema. (Default: false)" | ||
} | ||
|
||
variable if_not_exists { | ||
type = bool | ||
default = true | ||
description = "(Optional) When true, use the existing schema if it exists. (Default: true)" | ||
} |