Skip to content

Commit

Permalink
updating modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Weyder Ferreira committed Jul 27, 2022
1 parent b5d2eaa commit aaa4b11
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 0 deletions.
12 changes: 12 additions & 0 deletions postgres/role/main.tf
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
}
}
7 changes: 7 additions & 0 deletions postgres/role/outputs.tf
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
}
32 changes: 32 additions & 0 deletions postgres/role/vars.tf
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."
}
11 changes: 11 additions & 0 deletions postgres/schema/main.tf
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
}
}
9 changes: 9 additions & 0 deletions postgres/schema/outputs.tf
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"
}
26 changes: 26 additions & 0 deletions postgres/schema/vars.tf
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)"
}

0 comments on commit aaa4b11

Please sign in to comment.