Skip to content

Commit 6644266

Browse files
committed
add multi-network gateway and taurus public AD
1 parent 4506edb commit 6644266

File tree

3 files changed

+103
-5
lines changed

3 files changed

+103
-5
lines changed

resources/terraform/auto-drive/main.tf

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ data "aws_ami" "ubuntu_amd64" {
130130
}
131131

132132
################################################################################
133-
# Auto-Drive Instances
133+
# Auto-Drive Instances Mainnet
134134
################################################################################
135135

136136
module "ec2_auto_drive" {
@@ -171,7 +171,50 @@ module "ec2_auto_drive" {
171171
}
172172

173173
################################################################################
174-
# Gateway Instances
174+
# Auto-Drive Instances Testnet
175+
################################################################################
176+
177+
# note: we have one private auto-drive instance for taurus on hetzner, this is the public one
178+
179+
module "ec2_auto_drive_taurus" {
180+
source = "../../../templates/terraform/aws/ec2"
181+
182+
name = "${local.name}-taurus-backend"
183+
count = var.auto_drive_instance_count
184+
ami = data.aws_ami.ubuntu_amd64.id
185+
instance_type = "t3.medium"
186+
availability_zone = element(module.vpc.azs, 0)
187+
subnet_id = element(module.vpc.public_subnets, 0)
188+
vpc_security_group_ids = [aws_security_group.auto_drive_sg.id]
189+
iam_instance_profile = aws_iam_instance_profile.secrets_instance_profile.name
190+
associate_public_ip_address = false # Gateway instances use EIPs
191+
create_eip = true
192+
disable_api_stop = false
193+
194+
create_iam_instance_profile = true
195+
ignore_ami_changes = true
196+
iam_role_description = "IAM role for EC2 instance"
197+
iam_role_policies = {
198+
AdministratorAccess = "arn:aws:iam::aws:policy/AdministratorAccess"
199+
}
200+
root_block_device = [
201+
{
202+
device_name = "/dev/sdf"
203+
encrypted = true
204+
volume_type = "gp3"
205+
throughput = 250
206+
volume_size = var.auto_drive_root_volume_size
207+
}
208+
]
209+
volume_tags = merge(
210+
{ "Name" = "${local.name}-taurus-backend-root-volume-${count.index}" },
211+
var.tags
212+
)
213+
tags = merge(local.tags, { Role = "auto-drive-taurus" })
214+
}
215+
216+
################################################################################
217+
# Files Gateway Instances Mainnet
175218
################################################################################
176219

177220
module "ec2_gateway" {
@@ -209,3 +252,43 @@ module "ec2_gateway" {
209252
)
210253
tags = merge(local.tags, { Role = "gateway" })
211254
}
255+
256+
################################################################################
257+
# Multi-Network Gateway Instances
258+
################################################################################
259+
260+
module "ec2_multi_gateway" {
261+
source = "../../../templates/terraform/aws/ec2"
262+
name = "${local.name}-multi-network-gateway"
263+
count = var.multi_network_gateway_instance_count
264+
ami = data.aws_ami.ubuntu_amd64.id
265+
instance_type = var.multi_network_gateway_instance_type
266+
availability_zone = element(module.vpc.azs, 0)
267+
subnet_id = element(module.vpc.public_subnets, 0)
268+
vpc_security_group_ids = [aws_security_group.auto_drive_sg.id]
269+
associate_public_ip_address = false # Gateway instances use EIPs
270+
create_eip = true
271+
disable_api_stop = false
272+
273+
create_iam_instance_profile = true
274+
ignore_ami_changes = true
275+
iam_role_description = "IAM role for EC2 instance"
276+
iam_role_policies = {
277+
AdministratorAccess = "arn:aws:iam::aws:policy/AdministratorAccess"
278+
}
279+
280+
root_block_device = [
281+
{
282+
device_name = "/dev/sdf"
283+
encrypted = true
284+
volume_type = "gp3"
285+
throughput = 250
286+
volume_size = var.gateway_root_volume_size
287+
}
288+
]
289+
volume_tags = merge(
290+
{ "Name" = "${local.name}-multi-network-gateway-root-volume-${count.index}" },
291+
var.tags
292+
)
293+
tags = merge(local.tags, { Role = "multi-network-gateway" })
294+
}

resources/terraform/auto-drive/variables.tf

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ variable "tags" {
3232
variable "auto_drive_instance_type" {
3333
description = "Instance type for auto-drive instances."
3434
type = string
35-
default = "m7a.2xlarge"
35+
default = "m7a.large"
3636
}
3737

3838
variable "auto_drive_root_volume_size" {
@@ -45,7 +45,14 @@ variable "auto_drive_root_volume_size" {
4545
variable "gateway_instance_type" {
4646
description = "Instance type for gateway instances."
4747
type = string
48-
default = "m7a.2xlarge"
48+
default = "m7a.large"
49+
}
50+
51+
# Gateway Instance Configuration
52+
variable "multi_network_gateway_instance_type" {
53+
description = "Instance type for gateway instances."
54+
type = string
55+
default = "t3.medium"
4956
}
5057

5158
variable "gateway_root_volume_size" {
@@ -70,7 +77,7 @@ variable "kms_key_id" {
7077
variable "auto_drive_instance_count" {
7178
description = "Number of auto-drive instances to create."
7279
type = number
73-
default = 2
80+
default = 3
7481
}
7582

7683
variable "gateway_instance_count" {
@@ -79,6 +86,12 @@ variable "gateway_instance_count" {
7986
default = 1
8087
}
8188

89+
variable "multi_network_gateway_instance_count" {
90+
description = "Number of multi-network gateway instances to create."
91+
type = number
92+
default = 1
93+
}
94+
8295
variable "ingress_cidr_blocks" {
8396
description = "List of CIDR blocks for ingress"
8497
type = list(string)

templates/terraform/aws/ec2/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ resource "aws_instance" "this" {
197197
private_ip,
198198
associate_public_ip_address,
199199
vpc_security_group_ids,
200+
instance_type,
200201
]
201202
}
202203
}
@@ -384,6 +385,7 @@ resource "aws_instance" "ignore_ami" {
384385
private_ip,
385386
associate_public_ip_address,
386387
vpc_security_group_ids,
388+
instance_type,
387389
]
388390
}
389391
}

0 commit comments

Comments
 (0)