https://github.com/sourcefuse/terraform-aws-arc-postgresql-mgmt
https://github.com/sourcefuse/terraform-aws-arc-postgresql-mgmt
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/sourcefuse/terraform-aws-arc-postgresql-mgmt
- Owner: sourcefuse
- License: apache-2.0
- Created: 2023-11-08T20:34:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-17T01:41:35.000Z (over 1 year ago)
- Last Synced: 2025-08-01T05:55:58.902Z (8 months ago)
- Language: HCL
- Size: 4.16 MB
- Stars: 0
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README

# [terraform-postgresql-aws-arc-mgmt](https://github.com/sourcefuse/terraform-postgresql-aws-arc-mgmt)
 
[](https://sonarcloud.io/summary/new_code?id=sourcefuse_terraform-aws-arc-postgresql-mgmt)
[](https://github.com/sourcefuse/terraform-postgresql-aws-arc-mgmt/actions/workflows/snyk.yaml)
## Overview
It demonstrates how to create and manage a PostgreSQL database, roles, schemas, and associated resources on AWS.
In the example folder, you will see how this module should be called in downstream and how we can pass the values.
## Usage
```
required_providers {
postgresql = {
version = "~> 1.21"
source = "cyrilgdn/postgresql"
}
aws = {
version = "~> 5.0"
source = "hashicorp/aws"
}
}
```
1. Initialize Terraform with the backend config
```shell
terraform init -backend-config=config.dev.hcl
```
2. Plan Terraform
```shell
terraform plan -var-file .\tfvars\dev.tfvars
```
3. Apply Terraform
```shell
terraform apply -var-file .\tfvars\dev.tfvars
```
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | ~> 1.3, < 2.0.0 |
| [aws](#requirement\_aws) | ~> 5.0, < 6.0 |
| [postgresql](#requirement\_postgresql) | ~> 1.21 |
## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | 5.28.0 |
| [postgresql](#provider\_postgresql) | 1.21.0 |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_ssm_parameter.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) | resource |
| [postgresql_database.pg_db](https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs/resources/database) | resource |
| [postgresql_default_privileges.pg_default_privileges](https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs/resources/default_privileges) | resource |
| [postgresql_role.pg_role](https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs/resources/role) | resource |
| [postgresql_schema.pg_schema](https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs/resources/schema) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [pg\_roles](#input\_pg\_roles) | A map of objects where each key-value pair represents a PostgreSQL role |
map(object({
postgres_role_name = string
login = string
password = string
})) | n/a | yes |
| [pg\_ssm\_parameters](#input\_pg\_ssm\_parameters) | postgresql SSM parameters | map(object({
name = string
type = string
password = string
})) | n/a | yes |
| [postgresql\_database](#input\_postgresql\_database) | A map where each key-value pair represents a PostgreSQL database configuration | map(object({
db_name = string
db_owner = string
template = optional(string, null)
lc_collate = optional(string, null)
connection_limit = optional(string, null)
allow_connections = optional(string, null)
})) | n/a | yes |
| [postgresql\_default\_privileges](#input\_postgresql\_default\_privileges) | configuration block for postgresql default privileges | map(object({
role = string
database = string
schema = string
owner = string
object_type = string
privileges = list(string)
})) | n/a | yes |
| [postgresql\_schema](#input\_postgresql\_schema) | configuration block for postgresql schema | map(object({
schema_name = string
schema_owner = optional(string, null)
database = optional(string, null)
if_not_exists = optional(string, null)
drop_cascade = optional(string, null)
policy = optional(list(object({
usage = optional(string, null)
role = optional(string, null)
})), [])
})) | n/a | yes |
## Outputs
| Name | Description |
|------|-------------|
| [arn](#output\_arn) | ARN of the parameter |
## Development
### Prerequisites
- [terraform](https://learn.hashicorp.com/terraform/getting-started/install#installing-terraform)
- [terraform-docs](https://github.com/segmentio/terraform-docs)
- [pre-commit](https://pre-commit.com/#install)
- [golang](https://golang.org/doc/install#install)
- [golint](https://github.com/golang/lint#installation)
### Configurations
- Configure pre-commit hooks
```sh
pre-commit install
```
### Git commits
while Contributing or doing git commit please specify the breaking change in your commit message whether its major,minor or patch
For Example
```sh
git commit -m "your commit message #major"
```
By specifying this , it will bump the version and if you dont specify this in your commit message then by default it will consider patch and will bump that accordingly
### Tests
- Tests are available in `test` directory
- Configure the dependencies
```sh
cd test
go mod init github.com/sourcefuse/terraform-aws-ref-arch-db
go get github.com/gruntwork-io/terratest/modules/terraform
```
- Now execute the test
```sh
cd test/
go test
```
## Authors
This project is authored by:
- SourceFuse ARC Team