Skip to content

This repository contains OpenTofu/Terraform module which provisions and configures OCI Database for PostgreSQL.

License

Notifications You must be signed in to change notification settings

angeline-hilda/OCI-PostgreSQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oracle Cloud Infrastructure Terraform Module for OCI PostgreSQL

This OpenTofu/Terraform module provisions and configures OCI Database for PostgreSQL.

Features

  • OCI PostgreSQL Deployment: Deploys a PostgreSQL database with customizable parameters.

  • Network Setup: Configures a private subnet and security groups.

  • Automated Backups: Enables automatic backups.

  • Custom Configuration: Fine-tunes database settings such as max_connections.

  • Monitoring and Alerts: Sets up alarms for key performance metrics.

  • User and Database Initialization: Creates users, roles, and necessary extensions.

Configuration details

  • While creating PostgreSQL custom configurations:
    • Fixed shapes require specifying predefined OCPU and memory values corresponding to the selected shape.
    • For flexible shapes, set the memory and OCPU values as 0 or skip them, as these resources are controlled dynamically at the dbsystem level.
    • when defining the PostgreSQL configuration, specify the shape without the PostgresQL prefix (e.g., VM.Standard.E4.Flex). However, when creating a PostgreSQL database using this configuration, append PostgreSQL to the shape name (e.g., PostgreSQL..VM.Standard.E4.Flex).
    • the attribute is_flexible is a required field. Set this to true/false accordingly. Do not set this to null.
  • To enable extensions, use the value oci.admin_enabled_extensions
    db_configuration_overrides {
      items {
        config_key = "oci.admin_enabled_extensions"          
        overriden_config_value = "pglogical"                 # mention the OCI supported extension name here
      }
    }
    
    

Updating the Shape or Hardware Configuration of the DB system

  • After the provisioning of database, you may need to update the OCPU or memory based on the performance requirements.
  • Flexible shapes are mapped with flexible configurations, allowing customization of OCUPS and memory.
  • Fixed shapes have predefined OCPU and memory. If updating the fixed shape, the existing configuration can't be applied. You must either select an existing valid configuration or create a new configuration and pass it to the module.
  • Series of the shape cannot be changed. (eg., StandardE4 to StandardE5)

Prerequisites

Ensure you have the following before using this module:

Using with Terraform

This module is compatible with OpenTofu. To use Terraform instead of OpenTofu, ensure you have Terraform installed and use the following provider configuration:

terraform {
  required_providers {
    oci = {
      source = "oracle/oci"
      version = ">= 6.31.0"
    }
  }
}

Deploy using OpenTofu or Terraform

  1. Use terraform.tfvars File

    The repository includes a terraform.tfvars.example file. Edit it and replace the placeholder values with your actual OCI credentials, to create your own terraform.tfvars file.

  2. To deploy the resources, initialize and apply the configuration:

tofu init  # or terraform init
tofu plan  # or terraform plan
tofu apply # or terraform apply

Cleanup

To destroy the created resources, use:

tofu destroy # or terraform destroy

Documentation

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This repository contains OpenTofu/Terraform module which provisions and configures OCI Database for PostgreSQL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published