{"id":22423965,"url":"https://github.com/statcan/terraform-azurerm-postgresql","last_synced_at":"2026-01-24T22:06:51.078Z","repository":{"id":98764036,"uuid":"308635275","full_name":"StatCan/terraform-azurerm-postgresql","owner":"StatCan","description":"Terraform module to deploy a managed PostgreSQL instance on Azure","archived":false,"fork":false,"pushed_at":"2022-04-14T13:19:38.000Z","size":172,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-15T21:14:29.891Z","etag":null,"topics":["azure","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StatCan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-10-30T13:15:07.000Z","updated_at":"2023-04-03T08:42:11.000Z","dependencies_parsed_at":"2023-03-16T05:31:00.781Z","dependency_job_id":null,"html_url":"https://github.com/StatCan/terraform-azurerm-postgresql","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/StatCan/terraform-azurerm-postgresql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatCan%2Fterraform-azurerm-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatCan%2Fterraform-azurerm-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatCan%2Fterraform-azurerm-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatCan%2Fterraform-azurerm-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StatCan","download_url":"https://codeload.github.com/StatCan/terraform-azurerm-postgresql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatCan%2Fterraform-azurerm-postgresql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28737942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T21:19:41.845Z","status":"ssl_error","status_checked_at":"2026-01-24T21:13:38.675Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["azure","terraform"],"created_at":"2024-12-05T18:13:37.460Z","updated_at":"2026-01-24T22:06:51.064Z","avatar_url":"https://github.com/StatCan.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform for Azure Managed Database PostgreSQL\n\nCreates a PostgreSQL instance using the Azure Managed Database for PostgreSQL service.\n\n## Security Controls\n\n- Adheres to the [CIS Microsoft Azure Foundations Benchmark 1.3.0](https://docs.microsoft.com/en-us/azure/governance/policy/samples/cis-azure-1-3-0) for Database Services.\n\n## Dependencies\n\n- Terraform v0.14.x +\n- Terraform AzureRM Provider 2.5 +\n\n## Enabling Extensions\n\nAzure Database for PostgreSQL supports a subset of key extensions that are listed in the link below. This information is also available by running `SELECT * FROM pg_available_extensions;`.\n\nFor instance, application teams that have functionality that needs encryption can enable pg_crypto by using the `CREATE EXTENSION` command.\n\nhttps://docs.microsoft.com/en-us/azure/postgresql/concepts-extensions\n\n## Notes on Collation\n\nThe Azure Managed Database for Postgresql is currently using the Windows O.S. As such the collation names are different.\n\n```sh\nsudo -u postgres pg_dump -Fp —no-owner DBNAME | sed \"/COLLATE/s/en_US.utf8/English_United States.1252/ig\" | sed \"/CREATE COLLATION/s/en_US.utf8/English_United States.1252/ig\" | psql --host=aaa.postgres.database.azure.com --port=5432 --username=xxx@yyy --dbname=DBNAME\n```\n\nReference: https://stackoverflow.com/questions/47791728/azure-postgresql-server-service-collation-create-error\n\n## Usage\n\nExamples for this module along with various configurations can be found in the [examples/](examples/) folder.\n\n## Variables\n\n| Name                                     | Type             | Default           | Required | Description                                                                                                                          |\n| ---------------------------------------- | ---------------- | ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| active_directory_administrator_object_id | string           | `\"\"`              | no       | The Active Directory Administrator Object ID.                                                                                        |\n| active_directory_administrator_tenant_id | string           | `\"\"`              | no       | The Active Directory Administrator Tenant ID.                                                                                        |\n| administrator_login                      | string           | n/a               | yes      | The Administrator Login for the PostgreSQL Server.                                                                                   |\n| administrator_login_password             | string           | n/a               | yes      | The Password associated with the administrator_login for the PostgreSQL Server.                                                      |\n| databases                                | map(map(string)) | n/a               | yes      | The name, collatation, and charset of the PostgreSQL database(s). (defaults: charset=\"UTF8\", collation=\"English_United States.1252\") |\n| diagnostics                              | object()         | null              | no       | Diagnostic settings for those resources that support it.                                                                             |\n| emails                                   | list             | n/a               | yes      | List of email addresses that should recieve the security reports.                                                                    |\n| ip_rules                                 | list             | n/a               | yes      | List of public IP or IP ranges in CIDR Format.                                                                                       |\n| firewall_rules                           | list             | n/a               | yes      | Specifies the Start IP Address associated with this Firewall Rule.                                                                   |\n| location                                 | string           | `\"canadacentral\"` | no       | Specifies the supported Azure location where the resource exists.                                                                    |\n| name                                     | string           | n/a               | yes      | The name of the PostgreSQL Server.                                                                                                   |\n| pgsql_version                            | string           | `\"9.6\"`           | no       | The version of the PostgreSQL Server.                                                                                                |\n| public_network_access_enabled            | string           | `\"false\"`         | no       | Whether or not public network access is allowed for this server.                                                                     |\n| resource_group                           | string           | n/a               | yes      | The name of the resource group in which to create the PostgreSQL Server.                                                             |\n| retention_days                           | number           | `90`              | yes      | Specifies the retention in days for logs for this PostgreSQL Server.                                                                 |\n| sku_name                                 | string           | `\"GP_Gen5_4\"`     | no       | Specifies the SKU Name for this PostgreSQL Server.                                                                                   |\n| ssl_enforcement_enabled                  | string           | `\"true\"`          | no       | Specifies if SSL should be enforced on connections.                                                                                  |\n| ssl_minimal_tls_version_enforced         | string           | `\"TLS1_2\"`        | no       | The mimimun TLS version to support on the sever.                                                                                     |\n| storagesize_mb                           | string           | `\"640000\"`        | no       | Specifies the version of PostgreSQL to use.                                                                                          |\n| subnet_ids                               | list             | n/a               | yes      | The IDs of the subnets that the PostgreSQL server will be connected to.                                                              |\n| tags                                     | map              | `\"\u003cmap\u003e\"`         | no       | A mapping of tags to assign to the resource.                                                                                         |\n\n## Variables (Advanced)\n\n| Name                         | Type   | Default             | Required | Description                                                                                                       |\n| ---------------------------- | ------ | ------------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |\n| kv_db_create                 | string | null                | no       | Flag kv_db_create can either be `null` (default), `true` (create key vault), or `false` (use existing key vault). |\n| kv_db_name                   | string | null                | no       | The key vault name to be used when kv_db_create is either set to `true` or `false`.                               |\n| kv_db_rg                     | string | null                | no       | The key vault resource group to be used when kv_db_create is either set to `true` or `false`.\"                    |\n| kv_db_tenant_id              | string | null                | no       | The key vault tenant id to be used when kv_db_create is either set to `true` or `false`.                          |\n| kv_db_key_size               | number | `2048`              | no       | The key vault size to be used when kv_db_create is either set to `true` or `false`.                               |\n| kv_db_key_type               | string | `\"RSA\"`             | no       | The key vault type to be used when kv_db_create is either set to `true` or `false`.                               |\n| kv_pointer_enable            | string | `\"false\"`           | no       | Flag kv_pointer_enable can either be `true` (state from key vault), or `false` (state from terraform).            |\n| kv_pointer_name              | string | null                | no       | The key vault name to be used when kv_pointer_enable is set to `true`.                                            |\n| kv_workflow_rg               | string | null                | no       | The key vault resource group to be used when kv_pointer_enable is set to `true`.                                  |\n| kv_pointer_logging_name      | string | null                | no       | The logging name to be looked up in key vault when kv_pointer_enable is set to `true`.                            |\n| kv_pointer_logging_rg        | string | null                | no       | The logging resource group name to be used when kv_pointer_enable is set to `true`.                               |\n| kv_pointer_sqladmin_password | string | null                | no       | The sqladmin password to be looked up in key vault when kv_pointer_enable is set to `true`.\"                      |\n| vnet_create                  | string | null                | no       | Flag vnet_create can either be `null` (default), `true` (create vnet), or `false` (use existing vnet).            |\n| vnet_cidr                    | string | `172.15.0.0/16`     | no       | Virtual Network CIDR.                                                                                             |\n| vnet_name                    | string | null                | no       | The vnet name to be used when vnet_create is either set to `true` or `false`.                                     |\n| vnet_rg                      | string | null                | no       | The vnet resource group to be used when vnet_create is either set to `true` or `false`.                           |\n| subnet_name                  | string | null                | no       | The subnet name to be used when vnet_create is either set to `true` or `false`.                                   |\n| subnet_address_prefixes      | list   | `[\"172.15.8.0/22\"]` | no       | Virtual Network Address Prefixes.                                                                                 |\n\n## Variables (PostgreSQL Configuration)\n\n| Name                                  | Type   | Default     | Required | Description                                                                                                                          |\n| ------------------------------------- | ------ | ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| client_min_messages                   | string | `\"log\"`     | no       | Sets the message levels that are sent to the client.                                                                                 |\n| debug_print_parse                     | string | `\"off\"`     | no       | Logs each query's parse tree.                                                                                                        |\n| debug_print_plan                      | string | `\"off\"`     | no       | Logs each query's execution plan.                                                                                                    |\n| debug_print_rewritten                 | string | `\"off\"`     | no       | Logs each query's rewritten parse tree.                                                                                              |\n| log_checkpoints                       | string | `\"off\"`     | no       | Logs each checkpoint.                                                                                                                |\n| log_connections                       | string | `\"on\"`      | no       | Logs each successful connection.                                                                                                     |\n| log_disconnections                    | string | `\"on\"`      | no       | Logs end of a session, including duration.                                                                                           |\n| log_duration                          | string | `\"off\"`     | no       | Logs the duration of each completed SQL statement.                                                                                   |\n| log_error_verbosity                   | string | `\"default\"` | no       | Sets the verbosity of logged messages.                                                                                               |\n| log_line_prefix                       | string | `\"%t-%c-\"`  | no       | Sets the printf-style string that is output at the beginning of each log line.                                                       |\n| log_lock_waits                        | string | `\"off\"`     | no       | Logs long lock waits.                                                                                                                |\n| log_min_duration_statement            | string | `\"10\"`      | no       | Sets the minimum execution time (in milliseconds) above which statements will be logged.                                             |\n| log_min_error_statement               | string | `\"error\"`   | no       | Causes all statements generating error at or above this level to be logged.                                                          |\n| log_min_messages                      | string | `\"warning\"` | no       | Sets the message levels that are logged.                                                                                             |\n| log_retention_days                    | string | `\"7\"`       | no       | Sets how many days a log file is saved for.                                                                                          |\n| log_statement                         | string | `\"ddl\"`     | no       | Sets the type of statements logged.                                                                                                  |\n| row_security                          | string | `\"on\"`      | no       | Enable row security.                                                                                                                 |\n| checkpoint_warning                    | string | `\"0\"`       | no       | Enables warnings if checkpoint segments are filled more frequently than this.                                                        |\n| connection_throttling                 | string | `\"on\"`      | no       | Enables temporary connection throttling per IP for too many invalid password login failures.                                         |\n| maintenance_work_mem                  | string | `\"32000\"`   | no       | Sets the maximum memory to be used for maintenance operations. Unit is kb.                                                           |\n| min_wal_size                          | string | `\"512\"`     | no       | Sets the minimum size to shrink the WAL to. Unit is mb.                                                                              |\n| max_wal_size                          | string | `\"512\"`     | no       | Sets the WAL size that triggers a checkpoint. Unit is mb.                                                                            |\n| pg_stat_statements_track_utility      | string | `\"off\"`     | no       | Selects whether utility commands are tracked by pg_stat_statements.                                                                  |\n| pg_qs_track_utility                   | string | `\"on\"`      | no       | Selects whether utility commands are tracked by pg_qs.                                                                               |\n| pg_qs_query_capture_mode              | string | `\"top\"`     | no       | Selects which statements are tracked by pg_qs.                                                                                       |\n| pgms_wait_sampling_query_capture_mode | string | `\"all\"`     | no       | Selects which statements are tracked by the pgms_wait_sampling extension.                                                            |\n| synchronous_commit                    | string | `\"on\"`      | no       | Sets the current transaction's synchronization level.                                                                                |\n| temp_buffers                          | string | `\"16384\"`   | no       | Sets the maximum number of temporary buffers used by each database session. Unit is 8kb.                                             |\n| wal_buffers                           | string | `\"8192\"`    | no       | Sets the number of disk-page buffers in shared memory for WAL. Unit is 8kb.                                                          |\n| wal_writer_delay                      | string | `\"200\"`     | no       | Time between WAL flushes performed in the WAL writer. Unit is ms.                                                                    |\n| wal_writer_flush_after                | string | `\"128\"`     | no       | Amount of WAL written out by WAL writer that triggers a flush. Unit is 8kb.                                                          |\n| work_mem                              | string | `\"2048000\"` | no       | Sets the amount of memory to be used by internal sort operations and hash tables before writing to temporary disk files. Unit is kb. |\n\n## History\n\n| Date     | Release | Change                                                                                       |\n| -------- | ------- | -------------------------------------------------------------------------------------------- |\n| 20220406 | v4.1.1  | Fix a bug in the diagnostics section not calling metrics properly                            |\n| 20220406 | v4.1.0  | Allow changing the Storage Account Name                                                      |\n| 20211121 | v4.0.0  | Final refactor with sane defaults and optional advanced logic                                |\n| 20211004 | v3.0.0  | Release makes clear some of the more advanced logic                                          |\n| 20210907 | v2.2.0  | Release moves the key vault into the module                                                  |\n| 20210905 | v2.1.2  | Release adds ability to opt out of diagnostics                                               |\n| 20210902 | v2.1.1  | Release adds an ip_rules variable                                                            |\n| 20210831 | v2.1.0  | Release updates kv workflow, naming, and examples                                            |\n| 20210701 | v2.0.0  | Release prevents destruction of databases when one or more are added/removed from the list   |\n| 20210625 | v1.1.1  | Release which passes tags to other resources and fixes subnet rule names                     |\n| 20210623 | v1.1.0  | Release which add more configurable key-vault settings and easier changing to firewall/vnets |\n| 20210510 | v1.0.2  | Release which adds custom SA threat detection policy                                         |\n| 20210510 | v1.0.1  | Release which adds optional support for ATP                                                  |\n| 20210207 | v1.0.0  | Release of Terraform module                                                                  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatcan%2Fterraform-azurerm-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatcan%2Fterraform-azurerm-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatcan%2Fterraform-azurerm-postgresql/lists"}