Skip to content

Commit

Permalink
Merge pull request #1 from nikola-acuris/main
Browse files Browse the repository at this point in the history
Ability to specify different instance type for replicas
  • Loading branch information
marciogoda authored May 30, 2022
2 parents 51db222 + 56106b9 commit 18ac3bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ resource "aws_rds_cluster_parameter_group" "aurora_cluster_postgres96_parameter_
| envname | Environment name (eg,test, stage or prod) | string | - | yes |
| envtype | Environment type (eg,prod or nonprod) | string | - | yes |
| final_snapshot_identifier | The name to use when creating a final snapshot on cluster destroy, appends a random 8 digits to name to ensure it's unique too. | string | `final` | no |
| identifier_prefix | Prefix for cluster and instance identifier | string | `` | no |
| identifier_prefix | Prefix for cluster and instance identifier | string | `""` | no |
| instance_type | Instance type to use | string | `db.t2.small` | no |
| replica_instance_type | Instance type to use for replicas | string | `"" (inherits instance_type)` | no |
| monitoring_interval | The interval (seconds) between points when Enhanced Monitoring metrics are collected | string | `0` | no |
| name | Name given to DB subnet group | string | - | yes |
| password | Master DB password | string | - | yes |
Expand All @@ -199,7 +200,7 @@ resource "aws_rds_cluster_parameter_group" "aurora_cluster_postgres96_parameter_
| replica_scale_out_cooldown | Cooldown in seconds before allowing further scaling operations after a scale out | string | `300` | no |
| security_groups | VPC Security Group IDs | list | - | yes |
| 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 |
| 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 |
| subnets | List of subnet IDs to use | list | - | yes |
| username | Master DB username | string | `root` | no |
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ resource "aws_rds_cluster_instance" "cluster_instance_n" {
engine_version = var.engine-version
identifier = var.identifier_prefix != "" ? format("%s-node-%d", var.identifier_prefix, count.index + 1) : format("%s-aurora-node-%d", var.envname, count.index + 1)
cluster_identifier = aws_rds_cluster.default.id
instance_class = var.instance_type
instance_class = var.replica_instance_type != "" ? var.replica_instance_type : var.instance_type
publicly_accessible = var.publicly_accessible
db_subnet_group_name = aws_db_subnet_group.main.name
db_parameter_group_name = var.db_parameter_group_name
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ variable "instance_type" {
description = "Instance type to use"
}

variable "replica_instance_type" {
type = string
default = ""
description = "Instance type to use for replicas. Inherits instance_type value if unspecified."
}

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

0 comments on commit 18ac3bf

Please sign in to comment.