Skip to content

Commit d28591b

Browse files
authored
initial terraform configuration for devnet-0
initial terraform configuration for devnet-0
2 parents 8005d63 + 9ffc63c commit d28591b

File tree

8 files changed

+113
-41
lines changed

8 files changed

+113
-41
lines changed

terraform/devnet-0/.terraform.lock.hcl

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/devnet-0/digitalocean.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
////////////////////////////////////////////////////////////////////////////////////////
44
variable "digitalocean_project_name" {
55
type = string
6-
default = "Template"
6+
default = "glamsterdam-devnets"
77
}
88

99
variable "digitalocean_ssh_key_name" {
@@ -13,12 +13,12 @@ variable "digitalocean_ssh_key_name" {
1313

1414
variable "digitalocean_supernode_size" {
1515
type = string
16-
default = "s-8vcpu-32gb-640gb-intel"
16+
default = "s-8vcpu-16gb"
1717
}
1818

1919
variable "digitalocean_fullnode_size" {
2020
type = string
21-
default = "s-8vcpu-16gb"
21+
default = "s-4vcpu-8gb"
2222
}
2323

2424
variable "digitalocean_regions" {
@@ -192,7 +192,7 @@ resource "local_file" "ansible_inventory" {
192192
}
193193

194194
locals {
195-
ssh_config_path = pathexpand("~/.ssh/config.d/ssh_config.${var.ethereum_network}")
195+
ssh_config_path = pathexpand("~/.ssh/config.d/ssh_config.${var.ethereum_network}.digitalocean")
196196
}
197197

198198
resource "local_file" "ssh_config" {

terraform/devnet-0/firewall.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ resource "digitalocean_firewall" "bootnode" {
109109
}
110110

111111
resource "digitalocean_firewall" "mev_relay" {
112-
count = contains(keys(digitalocean_droplet.main), "mev-relay-1") ? 1 : 0
113-
name = "${var.ethereum_network}-nodes-mev-relay"
114-
tags = ["mev-relay:${var.ethereum_network}"]
112+
count = contains(keys(digitalocean_droplet.main), "mev-relay-1") ? 1 : 0
113+
name = "${var.ethereum_network}-nodes-mev-relay"
114+
tags = ["mev-relay:${var.ethereum_network}"]
115115

116116
// mev-relay ports
117117
inbound_rule {

terraform/devnet-0/hetzner/hetzner.tf

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ variable "hcloud_ssh_key_fingerprint" {
2020

2121
variable "hetzner_supernode_size" {
2222
type = string
23-
default = "cax41"
23+
default = "cax31"
2424
}
2525
variable "hetzner_fullnode_size" {
2626
type = string
27-
default = "cax31"
27+
default = "cax21"
2828
}
2929

3030
variable "hetzner_regions" {
@@ -196,3 +196,52 @@ resource "local_file" "ansible_inventory" {
196196
)
197197
filename = "../../../ansible/inventories/devnet-0/hetzner_inventory.ini"
198198
}
199+
200+
locals {
201+
ssh_config_path = pathexpand("~/.ssh/config.d/ssh_config.${var.ethereum_network}.hetzner")
202+
}
203+
204+
resource "local_file" "ssh_config" {
205+
content = templatefile("${path.module}/../ssh_config.tmpl",
206+
{
207+
ethereum_network = var.ethereum_network
208+
hosts = merge(
209+
{
210+
for key, server in hcloud_server.main : "${var.ethereum_network}-${key}" => {
211+
hostname = coalesce(server.ipv4_address, (try(server.ipv6_address, "")))
212+
private_ip = try(hcloud_server_network.main[key].ip, "")
213+
name = key
214+
user = "devops"
215+
}
216+
}
217+
)
218+
}
219+
)
220+
filename = local.ssh_config_path
221+
222+
depends_on = [hcloud_server.main]
223+
224+
lifecycle {
225+
create_before_destroy = true
226+
}
227+
}
228+
229+
# Ensure cleanup on destroy
230+
resource "null_resource" "ssh_config_cleanup" {
231+
triggers = {
232+
ssh_config_path = local.ssh_config_path
233+
}
234+
235+
# This provisioner runs on destroy
236+
provisioner "local-exec" {
237+
when = destroy
238+
command = "rm -f ${self.triggers.ssh_config_path} || true"
239+
}
240+
241+
depends_on = [local_file.ssh_config]
242+
}
243+
244+
output "ssh_config_file" {
245+
value = "SSH config generated at: ${local.ssh_config_path}"
246+
description = "Path to the generated SSH config file"
247+
}

terraform/devnet-0/hetzner/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ terraform {
3131
skip_s3_checksum = true
3232
region = "us-east-1"
3333
bucket = "merge-testnets"
34-
key = "infrastructure/template-devnet-0/hetzner-terraform.tfstate"
34+
key = "infrastructure/bal-devnet-0/hetzner-terraform.tfstate"
3535
}
3636
}
3737

@@ -54,7 +54,7 @@ variable "cloudflare_api_token" {
5454

5555
variable "ethereum_network" {
5656
type = string
57-
default = "template-devnet-0"
57+
default = "bal-devnet-0"
5858
}
5959

6060
variable "base_cidr_block" {

terraform/devnet-0/hetzner/nodes.tf

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
variable "bootnode" {
33
default = {
44
name = "bootnode"
5-
count = 0
5+
count = 1
66
validator_start = 0
77
validator_end = 0
88
}
@@ -11,7 +11,7 @@ variable "bootnode" {
1111
variable "mev_relay" {
1212
default = {
1313
name = "mev-relay"
14-
count = 1
14+
count = 0
1515
validator_start = 0
1616
validator_end = 0
1717
size = "ccx53"
@@ -24,9 +24,9 @@ variable "mev_relay" {
2424
variable "lighthouse_geth_super" {
2525
default = {
2626
name = "lighthouse-geth-super"
27-
count = 1
28-
validator_start = 200
29-
validator_end = 300
27+
count = 0
28+
validator_start = 0
29+
validator_end = 0
3030
}
3131
}
3232

@@ -134,27 +134,27 @@ variable "prysm_nimbusel_super" {
134134
variable "lodestar_geth_super" {
135135
default = {
136136
name = "lodestar-geth-super"
137-
count = 0
137+
count = 1
138138
validator_start = 0
139-
validator_end = 0
139+
validator_end = 200
140140
}
141141
}
142142

143143
variable "lodestar_nethermind_super" {
144144
default = {
145145
name = "lodestar-nethermind-super"
146-
count = 0
147-
validator_start = 0
148-
validator_end = 0
146+
count = 1
147+
validator_start = 200
148+
validator_end = 400
149149
}
150150
}
151151

152152
variable "lodestar_besu_super" {
153153
default = {
154154
name = "lodestar-besu-super"
155-
count = 0
156-
validator_start = 0
157-
validator_end = 0
155+
count = 1
156+
validator_start = 400
157+
validator_end = 600
158158
}
159159
}
160160

@@ -170,9 +170,9 @@ variable "lodestar_erigon_super" {
170170
variable "lodestar_reth_super" {
171171
default = {
172172
name = "lodestar-reth-super"
173-
count = 0
174-
validator_start = 0
175-
validator_end = 0
173+
count = 1
174+
validator_start = 600
175+
validator_end = 800
176176
}
177177
}
178178

@@ -356,9 +356,9 @@ variable "grandine_nimbusel_super" {
356356
variable "lighthouse_geth_full" {
357357
default = {
358358
name = "lighthouse-geth-full"
359-
count = 1
360-
validator_start = 300
361-
validator_end = 400
359+
count = 0
360+
validator_start = 0
361+
validator_end = 0
362362
}
363363
}
364364

@@ -680,4 +680,4 @@ variable "grandine_nimbusel_full" {
680680
validator_start = 0
681681
validator_end = 0
682682
}
683-
}
683+
}

terraform/devnet-0/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ terraform {
2727
skip_s3_checksum = true
2828
region = "us-east-1"
2929
bucket = "merge-testnets"
30-
key = "infrastructure/devnet-0/terraform.tfstate"
30+
key = "infrastructure/bal-devnet-0/terraform.tfstate"
3131
}
3232
}
3333

@@ -50,7 +50,7 @@ variable "cloudflare_api_token" {
5050

5151
variable "ethereum_network" {
5252
type = string
53-
default = "template-devnet-0"
53+
default = "bal-devnet-0"
5454
}
5555

5656
variable "base_cidr_block" {
@@ -137,4 +137,4 @@ locals {
137137
var.grandine_reth_full,
138138
var.grandine_nimbusel_full,
139139
]
140-
}
140+
}

terraform/devnet-0/nodes.tf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
variable "bootnode" {
33
default = {
44
name = "bootnode"
5-
count = 1
5+
count = 0
66
validator_start = 0
77
validator_end = 0
88
}
@@ -13,9 +13,9 @@ variable "bootnode" {
1313
variable "lighthouse_geth_super" {
1414
default = {
1515
name = "lighthouse-geth-super"
16-
count = 1
16+
count = 0
1717
validator_start = 0
18-
validator_end = 100
18+
validator_end = 0
1919
}
2020
}
2121

@@ -345,9 +345,9 @@ variable "grandine_nimbusel_super" {
345345
variable "lighthouse_geth_full" {
346346
default = {
347347
name = "lighthouse-geth-full"
348-
count = 1
349-
validator_start = 100
350-
validator_end = 200
348+
count = 0
349+
validator_start = 0
350+
validator_end = 0
351351
}
352352
}
353353

@@ -669,4 +669,4 @@ variable "grandine_nimbusel_full" {
669669
validator_start = 0
670670
validator_end = 0
671671
}
672-
}
672+
}

0 commit comments

Comments
 (0)