Skip to content

Commit 382ba00

Browse files
committed
refactor module
1 parent c343a16 commit 382ba00

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

infra/mainnet/main.tf

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ locals {
9292

9393
prometheus_regions = ["eu", "us", "ap", "sa"]
9494
}
95+
96+
sa_operators = {
97+
wallet-connect-2 = {
98+
vpc_cidr_octet = 0 # 10.0.0.0/16
99+
db = local.db_config
100+
nodes = [
101+
local.node_config,
102+
local.node_config,
103+
]
104+
}
105+
}
95106
}
96107

97108
module "wallet-connect-eu" {
@@ -160,27 +171,26 @@ module "wallet-connect-eu" {
160171
# }
161172
# }
162173

163-
module "sa-wallet-connect-extra" {
174+
module "sa-east-1" {
164175
source = "../modules/node-operator"
165-
count = 1
176+
for_each = local.eu_operators
166177

167-
config = {
168-
name = "wallet-connect-${count.index + 2}"
169-
secrets_file_path = "${path.module}/secrets/sa.wallet-connect-${count.index + 2}.sops.json"
170-
vpc_cidr_octet = 0 # 10.0.0.0/16
178+
config = merge(each.value, {
179+
name = each.key
171180
smart_contract_address = "0xca5b9bd2cf8045ff8308454c1b9caef2a6fcc20f"
172-
db = local.db_config
173-
nodes = [
174-
local.node_config,
175-
local.node_config,
176-
]
177-
}
181+
secrets_file_path = "${path.module}/secrets/sa.${each.key}.sops.json"
182+
})
178183

179184
providers = {
180185
aws = aws.sa
181186
}
182187
}
183188

189+
moved {
190+
from = module.sa-wallet-connect-extra[0]
191+
to = module.sa-east-1["wallet-connect-2"]
192+
}
193+
184194
output "sops-encryption-key-arn" {
185195
value = module.sops-encryption-key.arn
186196
}

0 commit comments

Comments
 (0)