Skip to content

Commit

Permalink
Add new storage type variable for RDS cluster (#3)
Browse files Browse the repository at this point in the history
* Add new storage type variable for RDS cluster

* Update storage_type description in README.md
  • Loading branch information
Ian Jones authored Mar 13, 2024
1 parent 92b6bfc commit 3c294ce
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,52 @@ resource "aws_rds_cluster_parameter_group" "aurora_57_cluster_parameter_group" {
description = "test-aurora-57-cluster-parameter-group"
}
```
### Aurora 2.x (MySQL 5.7) (I/O Optimised)

```hcl
resource "aws_sns_topic" "db_alarms" {
name = "aurora-db-alarms"
}
module "aurora_db_57" {
source = "claranet/aurora/aws"
engine = "aurora-mysql"
engine-version = "5.7.12"
name = "test-aurora-db-57"
envname = "test-57"
envtype = "test"
subnets = ["${module.vpc.private_subnets}"]
azs = ["${module.vpc.availability_zones}"]
replica_count = "1"
security_groups = ["${aws_security_group.allow_all.id}"]
instance_type = "db.t2.medium"
username = "root"
password = "changeme"
backup_retention_period = "5"
final_snapshot_identifier = "final-db-snapshot-prod"
storage_encrypted = "true"
storage_type = "aurora-iopt1"
apply_immediately = "true"
monitoring_interval = "10"
cw_alarms = true
cw_sns_topic = "${aws_sns_topic.db_alarms.id}"
db_parameter_group_name = "${aws_db_parameter_group.aurora_db_57_parameter_group.id}"
db_cluster_parameter_group_name = "${aws_rds_cluster_parameter_group.aurora_57_cluster_parameter_group.id}"
}
resource "aws_db_parameter_group" "aurora_db_57_parameter_group" {
name = "test-aurora-db-57-parameter-group"
family = "aurora-mysql5.7"
description = "test-aurora-db-57-parameter-group"
}
resource "aws_rds_cluster_parameter_group" "aurora_57_cluster_parameter_group" {
name = "test-aurora-57-cluster-parameter-group"
family = "aurora-mysql5.7"
description = "test-aurora-57-cluster-parameter-group"
}
```

### Aurora PostgreSQL

```hcl
Expand Down Expand Up @@ -203,6 +249,7 @@ resource "aws_rds_cluster_parameter_group" "aurora_cluster_postgres96_parameter_
| skip_final_snapshot | Should a final snapshot be created on cluster destroy | string | `false` | no |
| snapshot_identifier | DB snapshot to create this database from | string | `""` | no |
| storage_encrypted | Specifies whether the underlying storage layer should be encrypted | string | `true` | no |
| storage_type | Specifies the storage type to be associated with the DB cluster (use aurora-iopt1 for I/O Optimized) | string | `""` | no |
| subnets | List of subnet IDs to use | list | - | yes |
| username | Master DB username | string | `root` | no |

Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ resource "aws_rds_cluster" "default" {
vpc_security_group_ids = var.security_groups
snapshot_identifier = var.snapshot_identifier
storage_encrypted = var.storage_encrypted
storage_type = var.storage_type
apply_immediately = var.apply_immediately
db_cluster_parameter_group_name = var.db_cluster_parameter_group_name
deletion_protection = var.deletion_protection
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ variable "storage_encrypted" {
description = "Specifies whether the underlying storage layer should be encrypted"
}

variable "storage_type" {
type = string
default = ""
description = "Specifies the storage type to be associated with the DB cluster"
}

variable "cw_alarms" {
type = string
default = false
Expand Down

0 comments on commit 3c294ce

Please sign in to comment.