This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
114 lines (97 loc) · 3.2 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
provider "aws" {
region = var.region
}
data "aws_availability_zones" "available" {}
locals {
exafunction_vpc_cidr_block = "10.255.0.0/16"
peer_vpc_cidr_block = "10.0.0.0/16"
}
module "exafunction_network" {
source = "./modules/network"
vpc_name = "exafunction-vpc-${var.suffix}"
vpc_cidr_block = local.exafunction_vpc_cidr_block
}
module "exafunction_cluster" {
source = "./modules/cluster"
cluster_name = "exafunction-cluster-${var.suffix}"
cluster_version = "1.22"
vpc_id = module.exafunction_network.vpc_id
subnet_ids = module.exafunction_network.private_subnets
runner_pools = [{
suffix = "cpu"
node_instance_category = "cpu"
capacity_type = "SPOT"
node_instance_type = "m5.xlarge"
disk_size = 100
min_size = 1
max_size = 4
accelerator_label = ""
additional_taints = []
additional_labels = {}
}, {
suffix = "gpu"
node_instance_category = "gpu"
capacity_type = "ON_DEMAND"
node_instance_type = "g4dn.xlarge"
disk_size = 100
min_size = 0
max_size = 3
accelerator_label = "nvidia-tesla-t4"
additional_taints = []
additional_labels = {}
}]
instance_tags = {
"owner" = "exafunction"
}
autoscaling_group_tags = {
"owner" = "exafunction"
}
}
module "exafunction_module_repo_backend" {
source = "./modules/module_repo_backend"
exadeploy_id = "exafunction-mrbe-${var.suffix}"
db_storage = 15
postgres_version = "13"
db_username = "exafunction"
db_port = 5432
db_instance_class = "db.t4g.micro"
db_subnet_group_name = module.exafunction_network.database_subnet_group_name
vpc_security_group_ids = [
module.exafunction_cluster.cluster_primary_security_group_id,
module.exafunction_cluster.cluster_security_group_id,
module.exafunction_cluster.node_security_group_id,
]
}
module "peer_vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 3.0"
name = "peer-vpc-${var.suffix}"
cidr = local.peer_vpc_cidr_block
azs = data.aws_availability_zones.available.names
private_subnets = [
cidrsubnet(local.peer_vpc_cidr_block, 4, 1),
cidrsubnet(local.peer_vpc_cidr_block, 4, 2),
cidrsubnet(local.peer_vpc_cidr_block, 4, 3),
]
public_subnets = [
cidrsubnet(local.peer_vpc_cidr_block, 4, 4),
cidrsubnet(local.peer_vpc_cidr_block, 4, 5),
cidrsubnet(local.peer_vpc_cidr_block, 4, 6),
]
database_subnets = [
cidrsubnet(local.peer_vpc_cidr_block, 4, 7),
cidrsubnet(local.peer_vpc_cidr_block, 4, 8),
cidrsubnet(local.peer_vpc_cidr_block, 4, 9),
]
enable_nat_gateway = true
single_nat_gateway = true
enable_dns_hostnames = true
}
module "exafunction_peering" {
source = "./modules/peering"
vpc_id = module.exafunction_network.vpc_id
route_table_ids = module.exafunction_network.private_route_table_ids
security_group_id = module.exafunction_cluster.node_security_group_id
peer_vpc_id = module.peer_vpc.vpc_id
peer_route_table_ids = module.peer_vpc.private_route_table_ids
}