{"id":18906567,"url":"https://github.com/claranet/terraform-postgresql-users","last_synced_at":"2025-07-16T18:06:50.577Z","repository":{"id":148145376,"uuid":"575347646","full_name":"claranet/terraform-postgresql-users","owner":"claranet","description":"Terraform module for PostgreSQL users/roles management on an existing Database","archived":false,"fork":false,"pushed_at":"2025-03-28T08:54:28.000Z","size":74,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-18T12:53:16.253Z","etag":null,"topics":["claranet","module","postgresql","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/claranet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-07T10:02:34.000Z","updated_at":"2025-03-28T08:54:35.000Z","dependencies_parsed_at":"2025-04-12T06:05:33.260Z","dependency_job_id":"a710feef-4346-4fe1-88d9-db44bc139192","html_url":"https://github.com/claranet/terraform-postgresql-users","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/claranet/terraform-postgresql-users","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claranet%2Fterraform-postgresql-users","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claranet%2Fterraform-postgresql-users/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claranet%2Fterraform-postgresql-users/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claranet%2Fterraform-postgresql-users/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/claranet","download_url":"https://codeload.github.com/claranet/terraform-postgresql-users/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claranet%2Fterraform-postgresql-users/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265529092,"owners_count":23782822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claranet","module","postgresql","terraform"],"created_at":"2024-11-08T09:16:50.102Z","updated_at":"2025-07-16T18:06:50.311Z","avatar_url":"https://github.com/claranet.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostgreSQL users module\n[![Changelog](https://img.shields.io/badge/changelog-release-green.svg)](CHANGELOG.md) [![Notice](https://img.shields.io/badge/notice-copyright-yellow.svg)](NOTICE) [![Apache V2 License](https://img.shields.io/badge/license-Apache%20V2-orange.svg)](LICENSE) [![TF Registry](https://img.shields.io/badge/terraform-registry-blue.svg)](https://registry.terraform.io/modules/claranet/users/postgresql/)\n\nTerraform module using `PostgreSQL` provider to create users and manage their roles on an existing database.\nThis module will be used combined with others PostgreSQL modules (like [`azure-db-postgresql-flexible`](https://registry.terraform.io/modules/claranet/db-postgresql-flexible/azurerm/) or [`postgresql-database-configuration`](https://registry.terraform.io/modules/claranet/database-configuration/postgresql/) for example).\n\n\n\u003c!-- BEGIN_TF_DOCS --\u003e\n## Global versioning rule for Claranet Azure modules\n\n| Module version | Terraform version | OpenTofu version | AzureRM version |\n| -------------- | ----------------- | ---------------- | --------------- |\n| \u003e= 8.x.x       | **Unverified**    | 1.8.x            | \u003e= 4.0          |\n| \u003e= 7.x.x       | 1.3.x             |                  | \u003e= 3.0          |\n| \u003e= 6.x.x       | 1.x               |                  | \u003e= 3.0          |\n| \u003e= 5.x.x       | 0.15.x            |                  | \u003e= 2.0          |\n| \u003e= 4.x.x       | 0.13.x / 0.14.x   |                  | \u003e= 2.0          |\n| \u003e= 3.x.x       | 0.12.x            |                  | \u003e= 2.0          |\n| \u003e= 2.x.x       | 0.12.x            |                  | \u003c 2.0           |\n| \u003c  2.x.x       | 0.11.x            |                  | \u003c 2.0           |\n\n## Contributing\n\nIf you want to contribute to this repository, feel free to use our [pre-commit](https://pre-commit.com/) git hook configuration\nwhich will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.\n\nMore details are available in the [CONTRIBUTING.md](./CONTRIBUTING.md#pull-request-process) file.\n\n## Usage\n\nThis module is optimized to work with the [Claranet terraform-wrapper](https://github.com/claranet/terraform-wrapper) tool\nwhich set some terraform variables in the environment needed by this module.\nMore details about variables set by the `terraform-wrapper` available in the [documentation](https://github.com/claranet/terraform-wrapper#environment).\n\n⚠️ Since modules version v8.0.0, we do not maintain/check anymore the compatibility with\n[Hashicorp Terraform](https://github.com/hashicorp/terraform/). Instead, we recommend to use [OpenTofu](https://github.com/opentofu/opentofu/).\n\n```hcl\nmodule \"azure_region\" {\n  source  = \"claranet/regions/azurerm\"\n  version = \"x.x.x\"\n\n  azure_region = var.azure_region\n}\n\nmodule \"rg\" {\n  source  = \"claranet/rg/azurerm\"\n  version = \"x.x.x\"\n\n  location    = module.azure_region.location\n  client_name = var.client_name\n  environment = var.environment\n  stack       = var.stack\n}\n\nmodule \"db_pg_flex\" {\n  source  = \"claranet/db-postgresql-flexible/azurerm\"\n  version = \"x.x.x\"\n\n  client_name    = var.client_name\n  location       = module.azure_region.location\n  location_short = module.azure_region.location_short\n  environment    = var.environment\n  stack          = var.stack\n\n  resource_group_name = module.rg.resource_group_name\n\n  administrator_login    = var.administrator_login\n  administrator_password = var.administrator_password\n\n  allowed_cidrs = {}\n\n  databases = {\n    mydatabase = {\n      collation = \"en_US.utf8\"\n      charset   = \"UTF8\"\n    }\n  }\n\n\n  logs_destinations_ids = []\n}\n\nprovider \"postgresql\" {\n  host      = module.db_pg_flex.postgresql_flexible_fqdn\n  port      = 5432\n  username  = module.db_pg_flex.postgresql_flexible_administrator_login\n  password  = var.administrator_password\n  sslmode   = \"require\"\n  superuser = false\n}\n\nmodule \"postgresql_users\" {\n  source  = \"claranet/users/postgresql\"\n  version = \"x.x.x\"\n\n  for_each = toset(module.db_pg_flex.postgresql_flexible_databases_names)\n\n  administrator_login = module.db_pg_flex.postgresql_flexible_administrator_login\n\n  user     = each.key\n  database = each.key\n}\n\nmodule \"postgresql_configuration\" {\n  source  = \"claranet/database-configuration/postgresql\"\n  version = \"x.x.x\"\n\n  for_each = toset(module.db_pg_flex.postgresql_flexible_databases_names)\n\n  administrator_login = module.db_pg_flex.postgresql_flexible_administrator_login\n\n  database_admin_user = module.postgresql_users[each.key].user\n  database            = each.key\n  schema_name         = each.key\n}\n```\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| postgresql | \u003e= 1.14 |\n| random | \u003e= 3.0 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [postgresql_grant_role.db_user](https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs/resources/grant_role) | resource |\n| [postgresql_role.db_user](https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs/resources/role) | resource |\n| [random_password.db_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| administrator\\_login | Server administrator user name, used to allow it on the created roles. | `string` | n/a | yes |\n| database | Database in which create the user. | `string` | n/a | yes |\n| password | User password, generated if not set. | `string` | `null` | no |\n| roles | User database roles list. | `list(string)` | `[]` | no |\n| user | Name of the user to create. Defaults to `\u003cdatabase\u003e_user` if not set. | `string` | `null` | no |\n| user\\_search\\_path | User search path. | `string` | `null` | no |\n| with\\_admin\\_option | Giving ability to grant membership to others or not for the role. | `bool` | `false` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| database | Database name |\n| password | Password |\n| user | User |\n\u003c!-- END_TF_DOCS --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaranet%2Fterraform-postgresql-users","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclaranet%2Fterraform-postgresql-users","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaranet%2Fterraform-postgresql-users/lists"}