{"id":25524621,"url":"https://github.com/oracle-devrel/terraform-oci-arch-postgresql","last_synced_at":"2026-06-24T22:30:31.398Z","repository":{"id":37397404,"uuid":"424340507","full_name":"oracle-devrel/terraform-oci-arch-postgresql","owner":"oracle-devrel","description":"Terraform module to deploy PostgreSQL on Oracle Cloud Infrastructure (OCI).","archived":false,"fork":false,"pushed_at":"2025-01-21T20:10:58.000Z","size":106,"stargazers_count":12,"open_issues_count":9,"forks_count":20,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-06-17T16:06:57.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"upl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oracle-devrel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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}},"created_at":"2021-11-03T18:37:33.000Z","updated_at":"2025-02-13T10:04:01.000Z","dependencies_parsed_at":"2024-05-16T17:28:35.072Z","dependency_job_id":"23cccb52-9d18-4dfe-83cf-e99376b84eb1","html_url":"https://github.com/oracle-devrel/terraform-oci-arch-postgresql","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":"oracle-devrel/repo-template","purl":"pkg:github/oracle-devrel/terraform-oci-arch-postgresql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-devrel%2Fterraform-oci-arch-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-devrel%2Fterraform-oci-arch-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-devrel%2Fterraform-oci-arch-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-devrel%2Fterraform-oci-arch-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oracle-devrel","download_url":"https://codeload.github.com/oracle-devrel/terraform-oci-arch-postgresql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-devrel%2Fterraform-oci-arch-postgresql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34752465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-02-19T20:01:15.917Z","updated_at":"2026-06-24T22:30:31.294Z","avatar_url":"https://github.com/oracle-devrel.png","language":"HCL","funding_links":[],"categories":["HCL"],"sub_categories":[],"readme":"# terraform-oci-arch-postgresql\n\nPostgreSQL is an open source object-relational database management system. It’s highly extensible, highly scalable, and has many features. PostgreSQL supports data replication across multiple data centers.\n\nThis reference architecture shows a typical three-node deployment of a PostgreSQL cluster on Oracle Cloud Infrastructure Compute instances. In this architecture, the servers are configured in master and standby configuration and use streaming replication. It will also automatically install postgis34 and pgvector.\n\nFor details of the architecture, see [_Deploy a PostgreSQL database_](https://docs.oracle.com/en/solutions/deploy-postgresql-db/index.html)\n\n## Prerequisites\n\n- Permission to `manage` the following types of resources in your Oracle Cloud Infrastructure tenancy: `vcns`, `internet-gateways`, `route-tables`, `security-lists`, `subnets`, and `instances`.\n\n- Quota to create the following resources: 1 VCN, 1 subnet, 1 Internet Gateway, 1 route rules, and 3 compute instances (1 primary master PostgreSQL instance and 2 Standby instances of PostgreSQL).\n\nIf you don't have the required permissions and quota, contact your tenancy administrator. See [Policy Reference](https://docs.cloud.oracle.com/en-us/iaas/Content/Identity/Reference/policyreference.htm), [Service Limits](https://docs.cloud.oracle.com/en-us/iaas/Content/General/Concepts/servicelimits.htm), [Compartment Quotas](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcequotas.htm).\n\n## Deploy Using Oracle Resource Manager\n\n1. Click [![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?region=home\u0026zipUrl=https://github.com/oracle-devrel/terraform-oci-arch-postgresql/releases/latest/download/terraform-oci-arch-postgresql-stack-latest.zip)\n\n   If you aren't already signed in, when prompted, enter the tenancy and user credentials.\n\n2. Review and accept the terms and conditions.\n\n3. Select the region where you want to deploy the stack.\n\n4. Follow the on-screen prompts and instructions to create the stack.\n\n5. After creating the stack, click **Terraform Actions**, and select **Plan**.\n\n6. Wait for the job to be completed, and review the plan.\n\n   To make any changes, return to the Stack Details page, click **Edit Stack**, and make the required changes. Then, run the **Plan** action again.\n\n7. If no further changes are necessary, return to the Stack Details page, click **Terraform Actions**, and select **Apply**.\n\n## Deploy Using the Terraform CLI\n\n### Clone the Repository\n\nNow, you'll want a local copy of this repo. You can make that with the commands:\n\n    git clone https://github.com/oracle-devrel/terraform-oci-arch-postgresql\n    cd terraform-oci-arch-postgresql\n    ls\n\n### Prerequisites\n\nFirst off, you'll need to do some pre-deploy setup. That's all detailed [here](https://github.com/cloud-partners/oci-prerequisites).\n\nSecondly, create a `terraform.tfvars` file and populate with the following information:\n\n```\n# Authentication\ntenancy_ocid         = \"\u003ctenancy_ocid\u003e\"\nuser_ocid            = \"\u003cuser_ocid\u003e\"\nfingerprint          = \"\u003cfinger_print\u003e\"\nprivate_key_path     = \"\u003cpem_private_key_path\u003e\"\n\n# Region\nregion = \"\u003coci_region\u003e\"\n\n# availability Domain\navailability_domain_number = \"1\" # Example: 1, 2, 3\n\n# Compartment\ncompartment_ocid        = \"\u003ccompartment_ocid\u003e\"\n\n# PostgreSQL Password\n# The password must start with a letter, and it can contain letters (uppercase, lowercase), numbers, and the symbols _ $ #\n# Minimum length 12 and max is 30\npostgresql_password     = \"\u003cpostgresql_password\u003e\"\n\n# PostgreSQL Version (supported versions 9.6, 10, 11, 12, 13, 14)\npostgresql_version      = \"14\"\n\n# Cidr block that will be added in the firewall-cmd trusted zone on the instances running the postgresql server.\n# Please add a cidr block from where you run postgresql client.\npg_whitelist_cidr = \"\" # Example \"10.0.0.0/16\"\n\n\n### Using existing network\nuse_existing_vcn         = true\npostgresql_vcn           = \"\u003cpostgresqls_vcn_ocid\u003e\"\npostgresql_subnet        = \"\u003cpostgresql_subnet_ocid\u003e\"\ncreate_in_private_subnet = true # In case of deploying in a private subnet, a Bastion Service will be created.\n\n\nlinux_os_version = \"8\" # (supported versions : 7.9, 8)\n\n# SSH KEY\n# If you're using a PRIVATE subnet, the bastion service will be created.\n# The code will upload on the instances both the ssh public key that you provide and the one that will be GENERATED.\n# The bastion will automatically create sessions for instances using the private key GENERATED.\n# If you want to connect using your ssh key, create new sessions with your public key. You can also use the GENERATED ssh key.\nssh_public_key = \"\u003cyour_public_ssh_key\" #optional\n\n\n\n# Optional first HotStandby\npostgresql_deploy_hotstandby1 = false\n# PLEASE LEAVE THE postgresql_hotstandby1_ad = \"\" (empty string) if you're not using it.\npostgresql_hotstandby1_ad = \"\" # for example 2\npostgresql_hotstandby1_fd = \"\" # for example 2\n\n# Optional second HotStandby\npostgresql_deploy_hotstandby2 = false\n# PLEASE LEAVE THE postgresql_hotstandby2_ad = \"\" (empty string) if you're not using it.\npostgresql_hotstandby2_ad = \"\" # for example 1\npostgresql_hotstandby2_fd = \"\" # for example 3\n\n\n```\n\n### Create the Resources\n\nRun the following commands:\n\n    terraform init\n    terraform plan\n    terraform apply\n\n### Destroy the Deployment\n\nWhen you no longer need the deployment, you can run this command to destroy the resources:\n\n    terraform destroy\n\n## Deploy as a Module\n\nIt's possible to utilize this repository as remote module, providing the necessary inputs:\n\n```\nmodule \"arch-postgresql\" {\n  source                        = \"github.com/oracle-devrel/terraform-oci-arch-postgresql\"\n  tenancy_ocid                  = \"\u003ctenancy_ocid\u003e\"\n  user_ocid                     = \"\u003cuser_ocid\u003e\"\n  fingerprint                   = \"\u003cfinger_print\u003e\"\n  private_key_path              = \"\u003cprivate_key_path\u003e\"\n  region                        = \"\u003coci_region\u003e\"\n  availability_domain_name       = \"\u003cavailability_domain_name\u003e\"\n  compartment_ocid              = \"\u003ccompartment_ocid\u003e\"\n  use_existing_vcn              = true # You can inject your own VCN and subnet\n  create_in_private_subnet      = true # Subnet should be associated with NATGW and proper Route Table.\n  postgresql_vcn                = oci_core_virtual_network.my_vcn.id # Injected VCN\n  postgresql_subnet             = oci_core_subnet.my_private_subnet.id # Injected Private Subnet\n  postgresql_password           = \"\u003cpassword\u003e\"\n  postgresql_version            = \"14\"\n  pg_whitelist_cidr             = \"\" # Example \"10.0.0.0/16\"\n  linux_os_version              = \"8\"\n  ssh_public_key                = \"\u003cyour_public_ssh_key\"\n  postgresql_deploy_hotstandby1 = true # if we want to setup hotstandby1\n  postgresql_deploy_hotstandby2 = true # if we want to setup hotstandby2\n}\n```\n\n## Architecture Diagram\n\n![](./images/postgre-oci.png)\n\n## Contributing\n\nThis project is open source. Please submit your contributions by forking this repository and submitting a pull request! Oracle appreciates any contributions that are made by the open source community.\n\n## License\n\nCopyright (c) 2024 Oracle and/or its affiliates.\n\nLicensed under the Universal Permissive License (UPL), Version 1.0.\n\nSee [LICENSE](LICENSE.txt) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle-devrel%2Fterraform-oci-arch-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foracle-devrel%2Fterraform-oci-arch-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle-devrel%2Fterraform-oci-arch-postgresql/lists"}