From 2938162718d239025f48aa1be0a452e605f14ed1 Mon Sep 17 00:00:00 2001 From: ridwanfs Date: Tue, 26 Dec 2023 14:07:02 +0700 Subject: [PATCH] Feature 1 / add tfdoc and readme (#2) * feature-1 || aligning all tf-postgresql provider version * feature-1 || add README for modules and examples --------- Co-authored-by: Ridwan Fadjar --- README.md | 189 ++++--------------------- examples/config-1-basic/README.md | 48 +++++++ examples/config-1-basic/providers.tf | 2 +- examples/database-1-basic/README.md | 47 ++++++ examples/database-1-basic/providers.tf | 2 +- examples/grant-1-basic/README.md | 48 +++++++ examples/role-1-basic/README.md | 46 ++++++ examples/role-1-basic/providers.tf | 2 +- examples/sample-checklist.md | 23 --- modules/config/README.md | 44 ++++++ modules/config/versions.tf | 2 +- modules/database/README.md | 40 ++++++ modules/database/versions.tf | 2 +- modules/foreign_data_wrapper/README.md | 41 ++++++ modules/grant/README.md | 41 ++++++ modules/pubsub/README.md | 41 ++++++ modules/role/README.md | 43 ++++++ modules/role/versions.tf | 2 +- 18 files changed, 471 insertions(+), 192 deletions(-) create mode 100644 examples/config-1-basic/README.md create mode 100644 examples/database-1-basic/README.md create mode 100644 examples/grant-1-basic/README.md create mode 100644 examples/role-1-basic/README.md delete mode 100644 examples/sample-checklist.md create mode 100644 modules/config/README.md create mode 100644 modules/database/README.md create mode 100644 modules/foreign_data_wrapper/README.md create mode 100644 modules/grant/README.md create mode 100644 modules/pubsub/README.md create mode 100644 modules/role/README.md diff --git a/README.md b/README.md index e2af7f5..699eecf 100644 --- a/README.md +++ b/README.md @@ -1,184 +1,47 @@ -# Terraform MongoDB User +# Terraform PostgreSQL Admin -This is a Terraform module for managing user access at MongoDB. You can use this module both for commercial or non-commercial purposes. +This is a Terraform module for managing objects at PostgreSQL. You can use this module both for commercial or non-commercial purposes. -Currently, you can manage these resources in MongoDB by using this module: +Currently, you can manage these resources in PostgreSQL by using this module: -- users -- roles +- role +- database +- schema +- grant +- extension +- physical_replication_slot Tested in: -- MongoDB +- PostgreSQL ## A. Prerequisites Requirements: - Terraform with version >= 1.4 -- Kaginari/mongodb +- Cyrilgdn/postgresql - Hashicorp/random -Before we continue to use the module, please pay attention to these terms for `database `in this module: +## B. How to use this module for your Terraform project ? -- `role_db`, selected database for storing role configuration. Default value from tf-provider is `admin` -- `target_db`, selected database which the privilege will be assigned to. -- `auth_database`, database that will be used by the user for authentication +You can check any examples projects that use this module under `examples` directory. -## B. How to use this module for your Terraform project ? +- config-1-basic +- role-1-basic +- database-1-basic +- grant-1-basic -- Copy `example/basic-1` project from this module. You can extend it as per your requirements -- Configure MongoDB host and port by modifying the `providers.tf`. For example `localhost` and `27017` - - If you want to use another authentication method, [please read more at the provider documentation](https://registry.terraform.io/providers/Kaginari/mongodb/latest/docs) -- Configure `TF_VAR_mongodb_username` and `TF_VAR_mongodb_password` as environment variables. For example: - -``` -$ export TF_VAR_mongodb_username=root -$ export TF_VAR_mongodb_password=example -``` - -- Check `terraform.tfvars` inside the Project. Please try to see how the variables configured. -- Adjust the tfvars based on your requirements. The tfvars is just example. Then, Save it -- Run these commands: - -``` -$ terraform init -$ terraform plan -``` -This is the output when you run terraform plan successfully: - -``` -... - - # module.tf_mongodb_user.random_password.password["septian"] will be created - + resource "random_password" "password" { - + bcrypt_hash = (sensitive value) - + id = (known after apply) - + length = 16 - + lower = true - + min_lower = 0 - + min_numeric = 0 - + min_special = 0 - + min_upper = 0 - + number = true - + numeric = true - + override_special = "!#$%&*()-_=+[]{}<>:?" - + result = (sensitive value) - + special = true - + upper = true - } - -Plan: 10 to add, 0 to change, 0 to destroy. - -Changes to Outputs: - + mongodb_roles = { - + developer = "admin" - + guest = "admin" - } - + mongodb_users = { - + bejo = "reporting" - + fadjar = "reporting" - + ridwan = "reporting" - + septian = "reporting" - } - -``` - -After you feel confidence with the terraform plan output, let's apply it. - -``` -$ terraform apply -auto-approve -``` - -- If it succeed, you must see this kind of output on your terminal - -``` -... - -module.tf_mongodb_user.mongodb_db_role.roles["developer"]: Creation complete after 0s [id=YWRtaW4uZGV2ZWxvcGVy] -module.tf_mongodb_user.mongodb_db_role.roles["guest"]: Creation complete after 0s [id=YWRtaW4uZ3Vlc3Q=] -module.tf_mongodb_user.random_password.password["septian"]: Creation complete after 0s [id=none] -module.tf_mongodb_user.random_password.password["bejo"]: Creation complete after 0s [id=none] -module.tf_mongodb_user.random_password.password["fadjar"]: Creation complete after 0s [id=none] -module.tf_mongodb_user.random_password.password["ridwan"]: Creation complete after 0s [id=none] -module.tf_mongodb_user.mongodb_db_user.users["bejo"]: Creating... -module.tf_mongodb_user.mongodb_db_user.users["fadjar"]: Creating... -module.tf_mongodb_user.mongodb_db_user.users["septian"]: Creating... -module.tf_mongodb_user.mongodb_db_user.users["ridwan"]: Creating... -module.tf_mongodb_user.mongodb_db_user.users["bejo"]: Creation complete after 0s [id=cmVwb3J0aW5nLmJlam8=] -module.tf_mongodb_user.mongodb_db_user.users["ridwan"]: Creation complete after 0s [id=cmVwb3J0aW5nLnJpZHdhbg==] -module.tf_mongodb_user.mongodb_db_user.users["septian"]: Creation complete after 0s [id=cmVwb3J0aW5nLnNlcHRpYW4=] -module.tf_mongodb_user.mongodb_db_user.users["fadjar"]: Creation complete after 0s [id=cmVwb3J0aW5nLmZhZGphcg==] - -Apply complete! Resources: 10 added, 0 changed, 0 destroyed. - -Outputs: - -mongodb_roles = { - "developer" = "admin" - "guest" = "admin" -} -mongodb_users = { - "bejo" = "reporting" - "fadjar" = "reporting" - "ridwan" = "reporting" - "septian" = "reporting" -} -``` - -You will see at your MongoDB that users and roles are created once the terraform applied. +> p.s.: If you see foreign data wrapper and pubsub modules, basically it's executable. But when I run the example it's still showing `No changes infrastructure`. I keep the modules until I've found the workaround. ## C. Understanding tfvars scenarios -There are some scenarios that you could choose when using this module. For example: - -1. user could be assined without any roles - -``` -mongodb_users = [ - { - name = "bejo" - auth_database = "reporting" - roles = [] - }, -] - -``` - -2. user could be assigned with default roles (e.g. readAnyDatabase) - -``` -mongodb_users = [ - { - name = "septian" - auth_database = "reporting" - roles = [ - { - name = "readAnyDatabase", - role_db = "admin" - } - ] - }, -] - -``` - -3. user could be assigned with custom roles (e.g. developer) - -``` -mongodb_users = [ - { - name = "ridwan" - auth_database = "reporting" - roles = [ - { - name = "developer", - role_db = "admin" - } - ] - }, -] -``` +You can check any examples tfvars that use this module under `examples` directory. + +- config-1-basic +- role-1-basic +- database-1-basic +- grant-1-basic ## D. Ensuring quality @@ -202,8 +65,8 @@ The tools: ## E. How to contribute ? -If you find any issue, you can raise it here at our [Issue Tracker](https://github.com/ridwanbejo/terraform-mongodb-user/issues) +If you find any issue, you can raise it here at our [Issue Tracker](https://github.com/ridwanbejo/terraform-postgresql-admin/issues) -If you have something that you want to merge to this repo, just raise [Pull Requests](https://github.com/ridwanbejo/terraform-mongodb-user/pulls) +If you have something that you want to merge to this repo, just raise [Pull Requests](https://github.com/ridwanbejo/terraform-postgresql-admin/pulls) Ensure that you install all the tools from section D. for development purpose. diff --git a/examples/config-1-basic/README.md b/examples/config-1-basic/README.md new file mode 100644 index 0000000..d5b5e68 --- /dev/null +++ b/examples/config-1-basic/README.md @@ -0,0 +1,48 @@ +# Basic PostgreSQL config example + +## Usage + +To run this example you need to execute: + +``` +$ terraform init +$ terraform plan +$ terraform apply +``` + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [tf\_postgres\_config](#module\_tf\_postgres\_config) | ../../modules/config | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [postgres\_extension](#input\_postgres\_extension) | n/a | `list(any)` | `[]` | no | +| [postgres\_physical\_replication\_slots](#input\_postgres\_physical\_replication\_slots) | n/a | `list(any)` | `[]` | no | +| [postgres\_replication\_slots](#input\_postgres\_replication\_slots) | n/a | `list(any)` | `[]` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [postgres\_extension](#output\_postgres\_extension) | Current PostgreSQL Extensions | + diff --git a/examples/config-1-basic/providers.tf b/examples/config-1-basic/providers.tf index a0f1e10..ca1546e 100644 --- a/examples/config-1-basic/providers.tf +++ b/examples/config-1-basic/providers.tf @@ -4,7 +4,7 @@ terraform { required_providers { postgresql = { source = "cyrilgdn/postgresql" - version = "1.21.1-beta.1" + version = "1.21.0" } random = { diff --git a/examples/database-1-basic/README.md b/examples/database-1-basic/README.md new file mode 100644 index 0000000..f759128 --- /dev/null +++ b/examples/database-1-basic/README.md @@ -0,0 +1,47 @@ +# Basic PostgreSQL database and schema example + +## Usage + +To run this example you need to execute: + +``` +$ terraform init +$ terraform plan +$ terraform apply +``` + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [tf\_postgres\_database](#module\_tf\_postgres\_database) | ../../modules/database | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [postgres\_databases](#input\_postgres\_databases) | n/a | `list(any)` | `[]` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [postgres\_databases](#output\_postgres\_databases) | Current PostgreSQL databases | +| [postgres\_schemas](#output\_postgres\_schemas) | Current PostgreSQL schemas | + diff --git a/examples/database-1-basic/providers.tf b/examples/database-1-basic/providers.tf index a0f1e10..ca1546e 100644 --- a/examples/database-1-basic/providers.tf +++ b/examples/database-1-basic/providers.tf @@ -4,7 +4,7 @@ terraform { required_providers { postgresql = { source = "cyrilgdn/postgresql" - version = "1.21.1-beta.1" + version = "1.21.0" } random = { diff --git a/examples/grant-1-basic/README.md b/examples/grant-1-basic/README.md new file mode 100644 index 0000000..da91386 --- /dev/null +++ b/examples/grant-1-basic/README.md @@ -0,0 +1,48 @@ +# Basic PostgreSQL grant example + +## Usage + +To run this example you need to execute: + +``` +$ terraform init +$ terraform plan +$ terraform apply +``` + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [tf\_postgres\_grant](#module\_tf\_postgres\_grant) | ../../modules/grant | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [pg\_grant\_roles](#input\_pg\_grant\_roles) | n/a | `list(any)` | `[]` | no | +| [pg\_grants](#input\_pg\_grants) | n/a | `list(any)` | `[]` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [pg\_grant\_roles](#output\_pg\_grant\_roles) | Current PostgreSQL grant roles | +| [pg\_grants](#output\_pg\_grants) | Current PostgreSQL grants | + diff --git a/examples/role-1-basic/README.md b/examples/role-1-basic/README.md new file mode 100644 index 0000000..67d7743 --- /dev/null +++ b/examples/role-1-basic/README.md @@ -0,0 +1,46 @@ +# Basic PostgreSQL role example + +## Usage + +To run this example you need to execute: + +``` +$ terraform init +$ terraform plan +$ terraform apply +``` + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [tf\_postgres\_role](#module\_tf\_postgres\_role) | ../../modules/role | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [postgres\_roles](#input\_postgres\_roles) | n/a | `list(any)` | `[]` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [postgres\_roles](#output\_postgres\_roles) | Current PostgreSQL roles | + diff --git a/examples/role-1-basic/providers.tf b/examples/role-1-basic/providers.tf index a0f1e10..ca1546e 100644 --- a/examples/role-1-basic/providers.tf +++ b/examples/role-1-basic/providers.tf @@ -4,7 +4,7 @@ terraform { required_providers { postgresql = { source = "cyrilgdn/postgresql" - version = "1.21.1-beta.1" + version = "1.21.0" } random = { diff --git a/examples/sample-checklist.md b/examples/sample-checklist.md deleted file mode 100644 index c851ca6..0000000 --- a/examples/sample-checklist.md +++ /dev/null @@ -1,23 +0,0 @@ -# Sample Checklist - -available: - -- role -- database -- schema -- grant -- extension -- physical_replication_slot - -available, but return no changes: - -- fdw_server -- fdw_user_mapping -- publication -- subscription - -not available: - -- grant_role -- default_privilege -- replication_slot diff --git a/modules/config/README.md b/modules/config/README.md new file mode 100644 index 0000000..2321527 --- /dev/null +++ b/modules/config/README.md @@ -0,0 +1,44 @@ +# Terraform-PostgreSQL-Admin for managing config + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +| Name | Version | +|------|---------| +| [postgresql](#provider\_postgresql) | 1.21.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [postgresql_extension.extensions](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/extension) | resource | +| [postgresql_physical_replication_slot.physical_slots](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/physical_replication_slot) | resource | +| [postgresql_replication_slot.slots](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/replication_slot) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [extensions](#input\_extensions) | n/a |
list(object({
name = string
schema = optional(string)
version = optional(string)
database = optional(string)
drop_cascade = optional(bool)
create_cascade = optional(bool)
}))
| n/a | yes | +| [physical\_replication\_slots](#input\_physical\_replication\_slots) | n/a |
list(object({
name = string
}))
| n/a | yes | +| [replication\_slots](#input\_replication\_slots) | n/a |
list(object({
name = string
plugin = string
database = optional(string)
}))
| n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [postgres\_extensions](#output\_postgres\_extensions) | List of PostgreSQL extensions | +| [postgres\_physical\_replication\_slots](#output\_postgres\_physical\_replication\_slots) | List of PostgreSQL physical replication slots | +| [postgres\_replication\_slots](#output\_postgres\_replication\_slots) | List of PostgreSQL replication slots | + diff --git a/modules/config/versions.tf b/modules/config/versions.tf index 5e4c855..f39b854 100644 --- a/modules/config/versions.tf +++ b/modules/config/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { postgresql = { source = "cyrilgdn/postgresql" - version = "1.21.1-beta.1" + version = "1.21.0" } random = { diff --git a/modules/database/README.md b/modules/database/README.md new file mode 100644 index 0000000..d9dbd57 --- /dev/null +++ b/modules/database/README.md @@ -0,0 +1,40 @@ +# Terraform-PostgreSQL-Admin for managing database + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +| Name | Version | +|------|---------| +| [postgresql](#provider\_postgresql) | 1.21.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [postgresql_database.databases](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/database) | resource | +| [postgresql_schema.schemas](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/schema) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [databases](#input\_databases) | n/a |
list(object({
name = string
owner = optional(string)
tablespace_name = optional(string)
connection_limit = optional(number)
allow_connections = optional(bool)
is_template = optional(bool)
template = optional(string)
encoding = optional(string)
lc_collate = optional(string)
lc_ctype = optional(string)

schemas = optional(list(object({
name = string
owner = optional(string)
database = optional(string)
drop_cascade = optional(bool)
policies = optional(list(object({
role = optional(string)
create = optional(bool)
create_with_grant = optional(bool)
usage = optional(bool)
usage_with_grant = optional(bool)
})))
})))
}))
| n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [postgres\_databases](#output\_postgres\_databases) | List of PostgreSQL databases | +| [postgres\_schemas](#output\_postgres\_schemas) | List of PostgreSQL schemas | + diff --git a/modules/database/versions.tf b/modules/database/versions.tf index 87b1e57..4b7abdf 100644 --- a/modules/database/versions.tf +++ b/modules/database/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { postgresql = { source = "cyrilgdn/postgresql" - version = "1.21.1-beta.1" + version = "1.21.0" } random = { diff --git a/modules/foreign_data_wrapper/README.md b/modules/foreign_data_wrapper/README.md new file mode 100644 index 0000000..791b36c --- /dev/null +++ b/modules/foreign_data_wrapper/README.md @@ -0,0 +1,41 @@ +# Terraform-PostgreSQL-Admin for managing FDW + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +| Name | Version | +|------|---------| +| [postgresql](#provider\_postgresql) | 1.21.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [postgresql_server.fdw_servers](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/server) | resource | +| [postgresql_user_mapping.fdw_user_mappings](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/user_mapping) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [fdw\_servers](#input\_fdw\_servers) | n/a |
list(object({
server_name = string
fdw_name = string
options = optional(map(any))
server_type = optional(string)
server_version = optional(string)
server_owner = optional(string)
drop_cascade = optional(bool)
}))
| n/a | yes | +| [fdw\_user\_mappings](#input\_fdw\_user\_mappings) | n/a |
list(object({
user_name = string
server_name = string
options = optional(map(any))
}))
| n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [postgres\_fdw\_servers](#output\_postgres\_fdw\_servers) | List of PostgreSQL FDW servers | +| [postgres\_fdw\_user\_mappings](#output\_postgres\_fdw\_user\_mappings) | List of PostgreSQL FDW user mappings | + diff --git a/modules/grant/README.md b/modules/grant/README.md new file mode 100644 index 0000000..3000c77 --- /dev/null +++ b/modules/grant/README.md @@ -0,0 +1,41 @@ +# Terraform-PostgreSQL-Admin for managing grant + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +| Name | Version | +|------|---------| +| [postgresql](#provider\_postgresql) | 1.21.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [postgresql_grant.grants](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/grant) | resource | +| [postgresql_grant_role.grant_roles](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/grant_role) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [grant\_roles](#input\_grant\_roles) | n/a |
list(object({
role = string
grant_role = string
with_admin_option = optional(bool)
}))
| n/a | yes | +| [grants](#input\_grants) | n/a |
list(object({
role = string
database = string
schema = string
object_type = string
privileges = list(string)
objects = optional(list(string))
columns = optional(list(string))
with_grant_option = optional(bool)
}))
| n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [postgres\_grant\_roles](#output\_postgres\_grant\_roles) | List of PostgreSQL grant roles | +| [postgres\_grants](#output\_postgres\_grants) | List of PostgreSQL grants | + diff --git a/modules/pubsub/README.md b/modules/pubsub/README.md new file mode 100644 index 0000000..e5b994c --- /dev/null +++ b/modules/pubsub/README.md @@ -0,0 +1,41 @@ +# Terraform-PostgreSQL-Admin for managing PubSub + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +| Name | Version | +|------|---------| +| [postgresql](#provider\_postgresql) | 1.21.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [postgresql_publication.publications](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/publication) | resource | +| [postgresql_subscription.subscriptions](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/subscription) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [publications](#input\_publications) | n/a |
list(object({
name = string
database = optional(string)
tables = optional(string)
all_tables = optional(bool)
owner = optional(string)
drop_cascade = optional(bool)
publish_param = optional(string)

publish_via_partition_root_param = optional(bool)
}))
| n/a | yes | +| [subscriptions](#input\_subscriptions) | n/a |
list(object({
name = string
conninfo = object({
host = string
port = number
dbname = string
user = string
password = string
})
publications = list(string)
database = optional(string)
create_slot = optional(bool)
slot_name = optional(string)
}))
| n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [postgres\_publications](#output\_postgres\_publications) | List of PostgreSQL publications | +| [postgres\_subscriptions](#output\_postgres\_subscriptions) | List of PostgreSQL subscriptions | + diff --git a/modules/role/README.md b/modules/role/README.md new file mode 100644 index 0000000..bc744c0 --- /dev/null +++ b/modules/role/README.md @@ -0,0 +1,43 @@ +# Terraform-PostgreSQL-Admin for managing role + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [postgresql](#requirement\_postgresql) | 1.21.0 | +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +| Name | Version | +|------|---------| +| [postgresql](#provider\_postgresql) | 1.21.0 | +| [random](#provider\_random) | 3.5.1 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [postgresql_default_privileges.default_privileges](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/default_privileges) | resource | +| [postgresql_role.roles](https://registry.terraform.io/providers/cyrilgdn/postgresql/1.21.0/docs/resources/role) | resource | +| [random_password.password](https://registry.terraform.io/providers/hashicorp/random/3.5.1/docs/resources/password) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [default\_privileges](#input\_default\_privileges) | n/a |
list(object({
role = string
database = string
owner = string
object_type = string
privileges = string
schema = optional(string)
}))
| n/a | yes | +| [roles](#input\_roles) | n/a |
list(object({
name = string
login = optional(bool)
replication = optional(bool)
superuser = optional(bool)
create_database = optional(bool)
create_role = optional(bool)
inherit = optional(bool)
connection_limit = optional(number)
search_path = optional(list(string))
valid_until = optional(string)
assume_role = optional(string)
roles = optional(list(string))

skip_drop_role = optional(bool)
skip_reassign_owned = optional(bool)
statement_timeout = optional(number)
encrypted_password = optional(bool)

bypass_row_level_security = optional(bool)
}))
| n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [postgres\_default\_privileges](#output\_postgres\_default\_privileges) | List of PostgreSQL default privilages | +| [postgres\_roles](#output\_postgres\_roles) | List of PostgreSQL roles | + diff --git a/modules/role/versions.tf b/modules/role/versions.tf index 5e4c855..f39b854 100644 --- a/modules/role/versions.tf +++ b/modules/role/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { postgresql = { source = "cyrilgdn/postgresql" - version = "1.21.1-beta.1" + version = "1.21.0" } random = {