Modifying byo-vpc to allow dynamic read replica count as a variable (#26)
- Added support for dynamic input of RDS replicas
This commit is contained in:
1 parent
f23200d567
commit
effca06ef3
3 files changed
+18
-4
No files matched your search
+14
-4
@@ -1,3 +1,16 @@
|
||||
locals {
|
||||
replica_numbers = [
|
||||
"one", "two", "three", "four", "five", "six", "seven", "eight",
|
||||
"nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
|
||||
"fifteen", "sixteen"
|
||||
]
|
||||
|
||||
rds_replica_instances = {
|
||||
for index, replica_number in local.replica_numbers :
|
||||
replica_number => {} if index < var.rds_config.replicas
|
||||
}
|
||||
}
|
||||
|
||||
module "byo-db" {
|
||||
source = "./byo-db"
|
||||
vpc_id = var.vpc_config.vpc_id
|
||||
@@ -38,10 +51,7 @@ module "rds" {
|
||||
engine_version = var.rds_config.engine_version
|
||||
instance_class = var.rds_config.instance_class
|
||||
|
||||
instances = {
|
||||
one = {}
|
||||
two = {}
|
||||
}
|
||||
instances = local.rds_replica_instances
|
||||
|
||||
vpc_id = var.vpc_config.vpc_id
|
||||
subnets = var.rds_config.subnets
|
||||
|
||||
Reference in new issue
Block a user