Skip to content

Commit

Permalink
subql changes make module reusable
Browse files Browse the repository at this point in the history
- remove gemini references
- make resources more generic
  • Loading branch information
DaMandal0rian committed Oct 31, 2024
1 parent a8bfe12 commit 1e4cc4b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions explorer/terraform/aws/taurus/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module "subql" {
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
instance-count-blue = var.instance_count_blue
instance-count-blue = 0 #var.instance_count_blue
disk-volume-size = var.disk_volume_size
disk-volume-type = var.disk_volume_type
environment = "production"
Expand All @@ -54,7 +54,7 @@ module "subql" {
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
instance-count-green = 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
environment = "staging"
Expand Down
8 changes: 4 additions & 4 deletions templates/terraform/subql/base/instances.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_instance" "subql_blue_node" {
subnet_id = element(aws_subnet.public_subnets.*.id, 0)
availability_zone = element(var.azs, 0)
# Security Group
vpc_security_group_ids = ["${aws_security_group.gemini-subql-sg.id}"]
vpc_security_group_ids = ["${aws_security_group.subql-sg.id}"]
# the Public SSH key
key_name = var.aws_key_name
associate_public_ip_address = true
Expand Down Expand Up @@ -73,7 +73,7 @@ resource "aws_instance" "subql_green_node" {
subnet_id = element(aws_subnet.public_subnets.*.id, count.index)
availability_zone = element(var.azs, count.index)
# Security Group
vpc_security_group_ids = ["${aws_security_group.gemini-subql-sg.id}"]
vpc_security_group_ids = ["${aws_security_group.subql-sg.id}"]
# the Public SSH key
key_name = var.aws_key_name
associate_public_ip_address = true
Expand Down Expand Up @@ -140,7 +140,7 @@ resource "aws_instance" "nova_subql_blue_node" {
subnet_id = element(aws_subnet.public_subnets.*.id, count.index)
availability_zone = element(var.azs, count.index)
# Security Group
vpc_security_group_ids = ["${aws_security_group.gemini-subql-sg.id}"]
vpc_security_group_ids = ["${aws_security_group.subql-sg.id}"]
# the Public SSH key
key_name = var.aws_key_name
associate_public_ip_address = true
Expand Down Expand Up @@ -207,7 +207,7 @@ resource "aws_instance" "nova_subql_green_node" {
subnet_id = element(aws_subnet.public_subnets.*.id, count.index)
availability_zone = element(var.azs, count.index)
# Security Group
vpc_security_group_ids = ["${aws_security_group.gemini-subql-sg.id}"]
vpc_security_group_ids = ["${aws_security_group.subql-sg.id}"]
# the Public SSH key
key_name = var.aws_key_name
associate_public_ip_address = true
Expand Down
14 changes: 7 additions & 7 deletions templates/terraform/subql/base/network.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "aws_vpc" "gemini-subql-vpc" {
resource "aws_vpc" "subql-vpc" {
cidr_block = var.vpc_cidr_block
enable_dns_support = true
enable_dns_hostnames = true
Expand All @@ -12,7 +12,7 @@ resource "aws_vpc" "gemini-subql-vpc" {

resource "aws_subnet" "public_subnets" {
count = length(var.public_subnet_cidrs)
vpc_id = aws_vpc.gemini-subql-vpc.id
vpc_id = aws_vpc.subql-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 @@ -25,7 +25,7 @@ resource "aws_subnet" "public_subnets" {

resource "aws_internet_gateway" "subql-gw" {
count = length(var.public_subnet_cidrs)
vpc_id = aws_vpc.gemini-subql-vpc.id
vpc_id = aws_vpc.subql-vpc.id

tags = {
Name = "${var.network_name}-subql-gw-public-subnet-${count.index}"
Expand All @@ -39,7 +39,7 @@ resource "aws_internet_gateway" "subql-gw" {

resource "aws_route_table" "public_route_table" {
count = length(var.public_subnet_cidrs)
vpc_id = aws_vpc.gemini-subql-vpc.id
vpc_id = aws_vpc.subql-vpc.id

route {
cidr_block = "0.0.0.0/0"
Expand All @@ -66,10 +66,10 @@ resource "aws_route_table_association" "public_route_table_subnets_association"
route_table_id = element(aws_route_table.public_route_table.*.id, count.index)
}

resource "aws_security_group" "gemini-subql-sg" {
resource "aws_security_group" "subql-sg" {
name = "${var.network_name}-subql-sg"
description = "Allow HTTP and HTTPS inbound traffic"
vpc_id = aws_vpc.gemini-subql-vpc.id
vpc_id = aws_vpc.subql-vpc.id

ingress {
description = "HTTPS for VPC"
Expand Down Expand Up @@ -108,6 +108,6 @@ resource "aws_security_group" "gemini-subql-sg" {
}

depends_on = [
aws_vpc.gemini-subql-vpc
aws_vpc.subql-vpc
]
}
2 changes: 1 addition & 1 deletion templates/terraform/subql/base/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Output Variables

output "ingress_rules" {
value = aws_security_group.gemini-subql-sg.*.ingress
value = aws_security_group.subql-sg.*.ingress
}

output "subql_blue_node_server_id" {
Expand Down
2 changes: 1 addition & 1 deletion templates/terraform/subql/base/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ variable "aws_key_name" {
variable "network_name" {
description = "Network name"
type = string
default = "gemini-3h"
default = "taurus"
}

variable "path_to_scripts" {
Expand Down

0 comments on commit 1e4cc4b

Please sign in to comment.