From 34f4550dfe17aa330e38919e4abc02215120f710 Mon Sep 17 00:00:00 2001 From: DaMandal0rian Date: Tue, 19 Mar 2024 22:04:58 +0300 Subject: [PATCH] Explorer terraform minor fixes - add node-tag variable - make VPC reusable for all networks --- explorer/terraform/aws/gemini-3g/main.tf | 4 ++-- explorer/terraform/aws/gemini-3g/variables.tf | 4 ++++ explorer/terraform/aws/gemini-3h/main.tf | 6 +++--- explorer/terraform/aws/gemini-3h/variables.tf | 4 ++++ templates/terraform/explorer/base/network.tf | 13 +++++++------ 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/explorer/terraform/aws/gemini-3g/main.tf b/explorer/terraform/aws/gemini-3g/main.tf index 8d74c943..6a1fdfc6 100644 --- a/explorer/terraform/aws/gemini-3g/main.tf +++ b/explorer/terraform/aws/gemini-3g/main.tf @@ -68,7 +68,7 @@ module "squids" { network-name = "${var.network_name}" domain-prefix = "archive" node-org = "subspace" - node-tag = "gemini-3g-nov-19" + node-tag = var.node_tag docker-tag = "latest" instance-type = var.instance_type deployment-version = 0 @@ -83,7 +83,7 @@ module "squids" { network-name = "${var.network_name}" domain-prefix = "nova.archive" node-org = "subspace" - node-tag = "gemini-3g-nov-19" + node-tag = var.node_tag docker-tag = "evm-domain" instance-type = var.instance_type deployment-version = 0 diff --git a/explorer/terraform/aws/gemini-3g/variables.tf b/explorer/terraform/aws/gemini-3g/variables.tf index d206cc3e..2a060ffa 100644 --- a/explorer/terraform/aws/gemini-3g/variables.tf +++ b/explorer/terraform/aws/gemini-3g/variables.tf @@ -4,6 +4,10 @@ variable "netdata_token" { } +variable "node_tag" { + type = string +} + variable "nr_api_key" { description = "New relic API Key" type = string diff --git a/explorer/terraform/aws/gemini-3h/main.tf b/explorer/terraform/aws/gemini-3h/main.tf index 740c3e8b..bf926f69 100644 --- a/explorer/terraform/aws/gemini-3h/main.tf +++ b/explorer/terraform/aws/gemini-3h/main.tf @@ -27,7 +27,7 @@ module "squids" { instance-type = var.instance_type deployment-version = 0 regions = var.aws_region - instance-count-green = 0# var.instance_count_green + instance-count-green = 0 # var.instance_count_green disk-volume-size = var.disk_volume_size disk-volume-type = var.disk_volume_type prune = false @@ -68,7 +68,7 @@ module "squids" { network-name = "${var.network_name}" domain-prefix = "archive" node-org = "subspace" - node-tag = "gemini-3h-2024-feb-19" + node-tag = var.node_tag docker-tag = "latest" instance-type = var.instance_type deployment-version = 0 @@ -83,7 +83,7 @@ module "squids" { network-name = "${var.network_name}" domain-prefix = "nova.archive" node-org = "subspace" - node-tag = "gemini-3h-2024-feb-19" + node-tag = var.node_tag docker-tag = "latest" instance-type = var.instance_type deployment-version = 0 diff --git a/explorer/terraform/aws/gemini-3h/variables.tf b/explorer/terraform/aws/gemini-3h/variables.tf index fdcc9155..702061df 100644 --- a/explorer/terraform/aws/gemini-3h/variables.tf +++ b/explorer/terraform/aws/gemini-3h/variables.tf @@ -4,6 +4,10 @@ variable "netdata_token" { } +variable "node_tag" { + type = string +} + variable "nr_api_key" { description = "New relic API Key" type = string diff --git a/templates/terraform/explorer/base/network.tf b/templates/terraform/explorer/base/network.tf index d9ea0b29..9aca0dd7 100644 --- a/templates/terraform/explorer/base/network.tf +++ b/templates/terraform/explorer/base/network.tf @@ -1,9 +1,10 @@ -resource "aws_vpc" "gemini-3h-squid-vpc" { +resource "aws_vpc" "gemini-squid-vpc" { cidr_block = var.vpc_cidr_block enable_dns_support = true enable_dns_hostnames = true tags = { + Name = "${var.network_name}-squid-vpc" name = "${var.network_name}-squid-vpc" } } @@ -11,7 +12,7 @@ resource "aws_vpc" "gemini-3h-squid-vpc" { resource "aws_subnet" "public_subnets" { count = length(var.public_subnet_cidrs) - vpc_id = aws_vpc.gemini-3h-squid-vpc.id + vpc_id = aws_vpc.gemini-squid-vpc.id cidr_block = element(var.public_subnet_cidrs, count.index) availability_zone = element(var.azs, count.index) map_public_ip_on_launch = "true" @@ -24,7 +25,7 @@ resource "aws_subnet" "public_subnets" { resource "aws_internet_gateway" "squid-gw" { count = length(var.public_subnet_cidrs) - vpc_id = aws_vpc.gemini-3h-squid-vpc.id + vpc_id = aws_vpc.gemini-squid-vpc.id tags = { Name = "${var.network_name}-squid-gw-public-subnet-${count.index}" @@ -38,7 +39,7 @@ resource "aws_internet_gateway" "squid-gw" { resource "aws_route_table" "public_route_table" { count = length(var.public_subnet_cidrs) - vpc_id = aws_vpc.gemini-3h-squid-vpc.id + vpc_id = aws_vpc.gemini-squid-vpc.id route { cidr_block = "0.0.0.0/0" @@ -68,7 +69,7 @@ resource "aws_route_table_association" "public_route_table_subnets_association" resource "aws_security_group" "gemini-squid-sg" { name = "${var.network_name}-squid-sg" description = "Allow HTTP and HTTPS inbound traffic" - vpc_id = aws_vpc.gemini-3h-squid-vpc.id + vpc_id = aws_vpc.gemini-squid-vpc.id ingress { description = "HTTPS for VPC" @@ -107,6 +108,6 @@ resource "aws_security_group" "gemini-squid-sg" { } depends_on = [ - aws_vpc.gemini-3h-squid-vpc + aws_vpc.gemini-squid-vpc ] }