Skip to content

Commit

Permalink
Explorer terraform minor fixes
Browse files Browse the repository at this point in the history
- add node-tag variable
- make VPC reusable for all networks
  • Loading branch information
DaMandal0rian committed Mar 19, 2024
1 parent 37bf5a6 commit 34f4550
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions explorer/terraform/aws/gemini-3g/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions explorer/terraform/aws/gemini-3g/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ variable "netdata_token" {

}

variable "node_tag" {
type = string
}

variable "nr_api_key" {
description = "New relic API Key"
type = string
Expand Down
6 changes: 3 additions & 3 deletions explorer/terraform/aws/gemini-3h/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions explorer/terraform/aws/gemini-3h/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ variable "netdata_token" {

}

variable "node_tag" {
type = string
}

variable "nr_api_key" {
description = "New relic API Key"
type = string
Expand Down
13 changes: 7 additions & 6 deletions templates/terraform/explorer/base/network.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
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"
}
}


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"
Expand All @@ -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}"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -107,6 +108,6 @@ resource "aws_security_group" "gemini-squid-sg" {
}

depends_on = [
aws_vpc.gemini-3h-squid-vpc
aws_vpc.gemini-squid-vpc
]
}

0 comments on commit 34f4550

Please sign in to comment.