Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 85 additions & 2 deletions resources/terraform/auto-drive/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ data "aws_ami" "ubuntu_amd64" {
}

################################################################################
# Auto-Drive Instances
# Auto-Drive Instances Mainnet
################################################################################

module "ec2_auto_drive" {
Expand Down Expand Up @@ -171,7 +171,50 @@ module "ec2_auto_drive" {
}

################################################################################
# Gateway Instances
# Auto-Drive Instances Testnet
################################################################################

# note: we have one private auto-drive instance for taurus on hetzner, this is the public one

module "ec2_auto_drive_taurus" {
source = "../../../templates/terraform/aws/ec2"

name = "${local.name}-taurus-backend"
count = 1
ami = data.aws_ami.ubuntu_amd64.id
instance_type = "t3.medium"
availability_zone = element(module.vpc.azs, 0)
subnet_id = element(module.vpc.public_subnets, 0)
vpc_security_group_ids = [aws_security_group.auto_drive_sg.id]
iam_instance_profile = aws_iam_instance_profile.secrets_instance_profile.name
associate_public_ip_address = false # Gateway instances use EIPs
create_eip = true
disable_api_stop = false

create_iam_instance_profile = true
ignore_ami_changes = true
iam_role_description = "IAM role for EC2 instance"
iam_role_policies = {
AdministratorAccess = "arn:aws:iam::aws:policy/AdministratorAccess"
}
root_block_device = [
{
device_name = "/dev/sdf"
encrypted = true
volume_type = "gp3"
throughput = 250
volume_size = var.auto_drive_root_volume_size
}
]
volume_tags = merge(
{ "Name" = "${local.name}-taurus-backend-root-volume-${count.index}" },
var.tags
)
tags = merge(local.tags, { Role = "auto-drive-taurus" })
}

################################################################################
# Files Gateway Instances Mainnet
################################################################################

module "ec2_gateway" {
Expand Down Expand Up @@ -209,3 +252,43 @@ module "ec2_gateway" {
)
tags = merge(local.tags, { Role = "gateway" })
}

################################################################################
# Multi-Network Gateway Instances
################################################################################

module "ec2_multi_gateway" {
source = "../../../templates/terraform/aws/ec2"
name = "${local.name}-multi-network-gateway"
count = var.multi_network_gateway_instance_count
ami = data.aws_ami.ubuntu_amd64.id
instance_type = var.multi_network_gateway_instance_type
availability_zone = element(module.vpc.azs, 0)
subnet_id = element(module.vpc.public_subnets, 0)
vpc_security_group_ids = [aws_security_group.auto_drive_sg.id]
associate_public_ip_address = false # Gateway instances use EIPs
create_eip = true
disable_api_stop = false

create_iam_instance_profile = true
ignore_ami_changes = true
iam_role_description = "IAM role for EC2 instance"
iam_role_policies = {
AdministratorAccess = "arn:aws:iam::aws:policy/AdministratorAccess"
}

root_block_device = [
{
device_name = "/dev/sdf"
encrypted = true
volume_type = "gp3"
throughput = 250
volume_size = var.gateway_root_volume_size
}
]
volume_tags = merge(
{ "Name" = "${local.name}-multi-network-gateway-root-volume-${count.index}" },
var.tags
)
tags = merge(local.tags, { Role = "multi-network-gateway" })
}
19 changes: 16 additions & 3 deletions resources/terraform/auto-drive/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ variable "tags" {
variable "auto_drive_instance_type" {
description = "Instance type for auto-drive instances."
type = string
default = "m7a.2xlarge"
default = "m7a.large"
}

variable "auto_drive_root_volume_size" {
Expand All @@ -45,7 +45,14 @@ variable "auto_drive_root_volume_size" {
variable "gateway_instance_type" {
description = "Instance type for gateway instances."
type = string
default = "m7a.2xlarge"
default = "m7a.large"
}

# Gateway Instance Configuration
variable "multi_network_gateway_instance_type" {
description = "Instance type for gateway instances."
type = string
default = "t3.medium"
}

variable "gateway_root_volume_size" {
Expand All @@ -70,7 +77,7 @@ variable "kms_key_id" {
variable "auto_drive_instance_count" {
description = "Number of auto-drive instances to create."
type = number
default = 2
default = 3
}

variable "gateway_instance_count" {
Expand All @@ -79,6 +86,12 @@ variable "gateway_instance_count" {
default = 1
}

variable "multi_network_gateway_instance_count" {
description = "Number of multi-network gateway instances to create."
type = number
default = 1
}

variable "ingress_cidr_blocks" {
description = "List of CIDR blocks for ingress"
type = list(string)
Expand Down
2 changes: 2 additions & 0 deletions templates/terraform/aws/ec2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ resource "aws_instance" "this" {
private_ip,
associate_public_ip_address,
vpc_security_group_ids,
instance_type,
]
}
}
Expand Down Expand Up @@ -384,6 +385,7 @@ resource "aws_instance" "ignore_ami" {
private_ip,
associate_public_ip_address,
vpc_security_group_ids,
instance_type,
]
}
}
Expand Down