Skip to content

Commit

Permalink
updated to vars for Aurora Serverless V2
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremycook123 committed Jan 26, 2025
1 parent 31dc70d commit 7bca592
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
8 changes: 6 additions & 2 deletions terraform/k8s/archs/arch1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ locals {
master_username = "root"
master_password = "followthewhiterabbit"
db_name = "cloudacademy"
scaling_min = 2
scaling_max = 4
engine = "aurora-mysql"
engine_version = "8.0.mysql_aurora.3.08.0"
acu = {
min = 0.5
max = 1.0
}
}
}
```
Expand Down
8 changes: 6 additions & 2 deletions terraform/k8s/archs/arch2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ locals {
master_username = "root"
master_password = "followthewhiterabbit"
db_name = "cloudacademy"
scaling_min = 2
scaling_max = 4
engine = "aurora-mysql"
engine_version = "8.0.mysql_aurora.3.08.0"
acu = {
min = 0.5
max = 1.0
}
}
}
```
Expand Down
12 changes: 10 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ locals {
master_username = "root"
master_password = "followthewhiterabbit"
db_name = "cloudacademy"
scaling_min = 2
scaling_max = 4
engine = "aurora-mysql"
engine_version = "8.0.mysql_aurora.3.08.0"
acu = {
min = 0.5
max = 1.0
}
}
}

Expand Down Expand Up @@ -124,7 +128,11 @@ module "aurora" {
master_username = local.rds.master_username
master_password = local.rds.master_password
db_name = local.rds.db_name
engine = local.rds.engine
engine_version = local.rds.engine_version
secret_manager_arn = module.secretsmanager.arn
acu_min = local.rds.acu.min
acu_max = local.rds.acu.max
}

#====================================
Expand Down
8 changes: 4 additions & 4 deletions terraform/modules/aurora/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ resource "aws_security_group" "allow_mysql_from_private_subnets" {

resource "aws_rds_cluster" "cloudacademy" {
cluster_identifier = "cloudacademy"
engine = "aurora-mysql"
engine_version = "8.0.mysql_aurora.3.08.0"
engine = var.engine
engine_version = var.engine_version
enable_http_endpoint = true

master_username = var.master_username
Expand All @@ -35,8 +35,8 @@ resource "aws_rds_cluster" "cloudacademy" {
vpc_security_group_ids = [aws_security_group.allow_mysql_from_private_subnets.id]

serverlessv2_scaling_configuration {
min_capacity = 0.5 # Min ACU
max_capacity = 1.0 # Max ACU
min_capacity = var.acu_min
max_capacity = var.acu_max
}
}

Expand Down
16 changes: 16 additions & 0 deletions terraform/modules/aurora/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ variable "db_name" {
type = string
}

variable "engine" {
type = string
}

variable "engine_version" {
type = string
}

variable "secret_manager_arn" {
type = string
}

variable "acu_min" {
type = number
}

variable "acu_max" {
type = number
}

0 comments on commit 7bca592

Please sign in to comment.