Skip to content

Commit 796ad1e

Browse files
committed
comment out self hosted supabase in favor of free
1 parent 7d326a1 commit 796ad1e

File tree

5 files changed

+186
-110
lines changed

5 files changed

+186
-110
lines changed

terraform/.terraform.lock.hcl

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/data.tf

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
data "aws_vpc" "supabase" {
2-
id = module.supabase.vpc_id
3-
}
4-
5-
data "aws_subnets" "supabase_private" {
6-
7-
filter {
8-
name = "vpc-id"
9-
values = [data.aws_vpc.supabase.id]
10-
}
11-
12-
filter {
13-
name = "tag:aws-cdk:subnet-type"
14-
values = ["Private"]
15-
}
16-
}
17-
18-
data "aws_subnets" "supabase_public" {
19-
20-
filter {
21-
name = "vpc-id"
22-
values = [data.aws_vpc.supabase.id]
23-
}
24-
25-
filter {
26-
name = "tag:aws-cdk:subnet-type"
27-
values = ["Public"]
28-
}
29-
}
30-
31-
data "aws_secretsmanager_secret" "cluster_postgres_secret" {
32-
arn = module.supabase.cluster_postgres_secret
33-
}
34-
35-
data "aws_secretsmanager_secret_version" "cluster_postgres_secret" {
36-
secret_id = data.aws_secretsmanager_secret.cluster_postgres_secret.id
37-
}
1+
# data "aws_vpc" "supabase" {
2+
# id = module.supabase.vpc_id
3+
# }
4+
#
5+
# data "aws_subnets" "supabase_private" {
6+
#
7+
# filter {
8+
# name = "vpc-id"
9+
# values = [data.aws_vpc.supabase.id]
10+
# }
11+
#
12+
# filter {
13+
# name = "tag:aws-cdk:subnet-type"
14+
# values = ["Private"]
15+
# }
16+
# }
17+
#
18+
# data "aws_subnets" "supabase_public" {
19+
#
20+
# filter {
21+
# name = "vpc-id"
22+
# values = [data.aws_vpc.supabase.id]
23+
# }
24+
#
25+
# filter {
26+
# name = "tag:aws-cdk:subnet-type"
27+
# values = ["Public"]
28+
# }
29+
# }
30+
#
31+
# data "aws_secretsmanager_secret" "cluster_postgres_secret" {
32+
# arn = module.supabase.cluster_postgres_secret
33+
# }
34+
#
35+
# data "aws_secretsmanager_secret_version" "cluster_postgres_secret" {
36+
# secret_id = data.aws_secretsmanager_secret.cluster_postgres_secret.id
37+
# }

terraform/hosted_main.tf

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
resource "aws_security_group" "ponder" {
3+
4+
name = "ponder"
5+
vpc_id = module.vpc.vpc_id
6+
7+
egress {
8+
from_port = 0
9+
to_port = 0
10+
protocol = "-1"
11+
cidr_blocks = ["0.0.0.0/0"]
12+
}
13+
14+
ingress {
15+
from_port = 0
16+
to_port = 0
17+
protocol = "-1"
18+
cidr_blocks = ["0.0.0.0/0"]
19+
}
20+
}
21+
22+
module "vpc" {
23+
source = "terraform-aws-modules/vpc/aws"
24+
version = "5.13.0"
25+
26+
name = "ponder"
27+
cidr = "10.0.0.0/16"
28+
29+
azs = ["us-east-1a", "us-east-1b", "us-east-1c"]
30+
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
31+
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
32+
33+
enable_nat_gateway = true
34+
enable_vpn_gateway = true
35+
}
36+
37+
resource "random_id" "hosted_supabase" {
38+
byte_length = 4
39+
}
40+
41+
resource "aws_secretsmanager_secret" "hosted_supabase" {
42+
name = "${local.app_name}-hosted-supabase-${random_id.hosted_supabase.hex}"
43+
44+
force_overwrite_replica_secret = true
45+
}
46+
47+
48+
module "ponder" {
49+
source = "./ponder"
50+
app_name = local.app_name
51+
vpc_id = module.vpc.vpc_id
52+
security_group_id = aws_security_group.ponder.id
53+
private_subnet_ids = module.vpc.private_subnets
54+
region = var.region
55+
postgres_secret_id = aws_secretsmanager_secret.hosted_supabase.id
56+
ponder_secrets_id = aws_secretsmanager_secret.ponder_secrets.id
57+
}

terraform/main.tf

+49-49
Original file line numberDiff line numberDiff line change
@@ -9,52 +9,52 @@ module "tags" {
99
env = terraform.workspace
1010
}
1111

12-
module "supabase" {
13-
source = "./supabase"
14-
app_name = local.app_name
15-
supabase_email = "[email protected]"
16-
supabase_sender_name = "GamCap Labs"
17-
supabase_disable_signup = "false"
18-
supabase_site_url = "http://localhost:3000"
19-
}
20-
21-
resource "aws_security_group" "ponder" {
22-
23-
name = "ponder"
24-
vpc_id = module.supabase.vpc_id
25-
26-
egress {
27-
from_port = 0
28-
to_port = 0
29-
protocol = "-1"
30-
cidr_blocks = ["0.0.0.0/0"]
31-
}
32-
33-
ingress {
34-
from_port = 0
35-
to_port = 0
36-
protocol = "-1"
37-
cidr_blocks = ["0.0.0.0/0"]
38-
}
39-
}
40-
41-
resource "aws_vpc_security_group_ingress_rule" "ponder" {
42-
description = "EC2 instance security group ingress rule from Supabase database migration function security group"
43-
from_port = jsondecode(data.aws_secretsmanager_secret_version.cluster_postgres_secret.secret_string)["port"]
44-
to_port = jsondecode(data.aws_secretsmanager_secret_version.cluster_postgres_secret.secret_string)["port"]
45-
referenced_security_group_id = aws_security_group.ponder.id
46-
ip_protocol = "tcp"
47-
security_group_id = module.supabase.cluster_security_group
48-
}
49-
50-
module "ponder" {
51-
source = "./ponder"
52-
53-
app_name = local.app_name
54-
vpc_id = module.supabase.vpc_id
55-
security_group_id = aws_security_group.ponder.id
56-
private_subnet_ids = data.aws_subnets.supabase_private.ids
57-
region = var.region
58-
postgres_secret_id = data.aws_secretsmanager_secret.cluster_postgres_secret.id
59-
ponder_secrets_id = aws_secretsmanager_secret.ponder_secrets.id
60-
}
12+
# module "supabase" {
13+
# source = "./supabase"
14+
# app_name = local.app_name
15+
# supabase_email = "[email protected]"
16+
# supabase_sender_name = "GamCap Labs"
17+
# supabase_disable_signup = "false"
18+
# supabase_site_url = "http://localhost:3000"
19+
# }
20+
#
21+
# resource "aws_security_group" "ponder" {
22+
#
23+
# name = "ponder"
24+
# vpc_id = module.supabase.vpc_id
25+
#
26+
# egress {
27+
# from_port = 0
28+
# to_port = 0
29+
# protocol = "-1"
30+
# cidr_blocks = ["0.0.0.0/0"]
31+
# }
32+
#
33+
# ingress {
34+
# from_port = 0
35+
# to_port = 0
36+
# protocol = "-1"
37+
# cidr_blocks = ["0.0.0.0/0"]
38+
# }
39+
# }
40+
#
41+
# resource "aws_vpc_security_group_ingress_rule" "ponder" {
42+
# description = "EC2 instance security group ingress rule from Supabase database migration function security group"
43+
# from_port = jsondecode(data.aws_secretsmanager_secret_version.cluster_postgres_secret.secret_string)["port"]
44+
# to_port = jsondecode(data.aws_secretsmanager_secret_version.cluster_postgres_secret.secret_string)["port"]
45+
# referenced_security_group_id = aws_security_group.ponder.id
46+
# ip_protocol = "tcp"
47+
# security_group_id = module.supabase.cluster_security_group
48+
# }
49+
#
50+
# module "ponder" {
51+
# source = "./ponder"
52+
#
53+
# app_name = local.app_name
54+
# vpc_id = module.supabase.vpc_id
55+
# security_group_id = aws_security_group.ponder.id
56+
# private_subnet_ids = data.aws_subnets.supabase_private.ids
57+
# region = var.region
58+
# postgres_secret_id = data.aws_secretsmanager_secret.cluster_postgres_secret.id
59+
# ponder_secrets_id = aws_secretsmanager_secret.ponder_secrets.id
60+
# }

terraform/outputs.tf

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
output "secret_string" {
2-
sensitive = true
3-
value = data.aws_secretsmanager_secret_version.cluster_postgres_secret.secret_string
4-
}
5-
6-
output "supabase_url" {
7-
value = module.supabase.supabase_url
8-
}
9-
10-
output "studio_url" {
11-
value = module.supabase.studio_url
12-
}
13-
14-
output "vpc_id" {
15-
value = module.supabase.vpc_id
16-
}
17-
18-
output "cluster_arn" {
19-
value = module.supabase.cluster_arn
20-
}
21-
22-
output "cluster_security_group" {
23-
value = module.supabase.cluster_security_group
24-
}
1+
# output "secret_string" {
2+
# sensitive = true
3+
# value = data.aws_secretsmanager_secret_version.cluster_postgres_secret.secret_string
4+
# }
5+
#
6+
# output "supabase_url" {
7+
# value = module.supabase.supabase_url
8+
# }
9+
#
10+
# output "studio_url" {
11+
# value = module.supabase.studio_url
12+
# }
13+
#
14+
# output "vpc_id" {
15+
# value = module.supabase.vpc_id
16+
# }
17+
#
18+
# output "cluster_arn" {
19+
# value = module.supabase.cluster_arn
20+
# }
21+
#
22+
# output "cluster_security_group" {
23+
# value = module.supabase.cluster_security_group
24+
# }

0 commit comments

Comments
 (0)