Skip to content

Commit

Permalink
add storage size support and define replica region (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnduati authored Jan 8, 2024
1 parent 1004678 commit 704b7d3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .deepsource.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 1

[[analyzers]]
name = "terraform"
name = "terraform"
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:

- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.12 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
rev: v0.1.23 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
hooks:
- id: terraform-fmt
- id: shellcheck
- id: tflint

- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1 # Use the ref you want to point at
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Use the ref you want to point at
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Terraform Module Database
</h1>

<p align="center" style="font-size: 1.2rem;">
<p align="center" style="font-size: 1.2rem;">
Terraform module to create Digitalocean database service resource on Digitalocean.
</p>

Expand Down Expand Up @@ -41,7 +41,7 @@
<hr>


We eat, drink, sleep and most importantly love **DevOps**. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy <b>Bigger problems are always solved by breaking them into smaller manageable problems</b>. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller <b>connected yet manageable pieces</b> within the infrastructure.
We eat, drink, sleep and most importantly love **DevOps**. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy <b>Bigger problems are always solved by breaking them into smaller manageable problems</b>. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller <b>connected yet manageable pieces</b> within the infrastructure.

This module is basically combination of [Terraform open source](https://www.terraform.io/) and includes automatation tests and examples. It also helps to create and improve your infrastructure with minimalistic code instead of maintaining the whole infrastructure code yourself.

Expand All @@ -52,7 +52,7 @@ We have [*fifty plus terraform modules*][terraform_modules]. A few of them are c

## Prerequisites

This module has a few dependencies:
This module has a few dependencies:
- [Terraform 1.5.4](https://learn.hashicorp.com/terraform/getting-started/install.html)


Expand Down Expand Up @@ -385,7 +385,7 @@ Here are examples of how you can use this module in your inventory structure:


## Testing
In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system.
In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system.

You need to run the following command in the testing folder:
```hcl
Expand All @@ -394,7 +394,7 @@ You need to run the following command in the testing folder:



## Feedback
## Feedback
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/terraform-module-database/issues), or feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com).

If you have found it worth your time, go ahead and give us a ★ on [our GitHub](https://github.com/clouddrove/terraform-module-database)!
Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "digitalocean_database_cluster" "cluster" {
eviction_policy = var.redis_eviction_policy
sql_mode = var.mysql_sql_mode
project_id = var.project_id
storage_size_mib = var.storage_size_mib

dynamic "maintenance_window" {
for_each = var.cluster_maintenance != null ? [var.cluster_maintenance] : []
Expand Down Expand Up @@ -101,7 +102,7 @@ resource "digitalocean_database_replica" "replica-example" {
cluster_id = join("", digitalocean_database_cluster.cluster[*].id)
name = format("%s-${var.cluster_engine}-replica", module.labels.id)
size = var.replica_size
region = var.region
region = var.replica_region
tags = [module.labels.id]
private_network_uuid = var.cluster_private_network_uuid
}
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,8 @@ variable "replica_enable" {
default = false
description = "Flag to control the resources creation."
}
variable "storage_size_mib" {
type = string
description = "Defines the disk size, in MiB, allocated to the cluster"
default = null
}

0 comments on commit 704b7d3

Please sign in to comment.