This repository has been archived by the owner on Aug 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
135 lines (114 loc) · 2.66 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
module "vpc" {
source = "./modules/vpc"
/**
vpc_cidr_block
vpc_name_tag
az
lan_subnets
lan_subnets_name_tag
public_subnets
public_subnets_name_tag
nat_gateway_name_tag
default_route_name_tag
*/
}
module "security" {
source = "./modules/security"
vpc_id = module.vpc.vpc_id
ssh_key_name = var.ssh_key_name
ssh_public_key = var.ssh_public_key
admin_public_ip = var.admin_ip
account_id= var.account_id
/**
internal_sec_gr_name_tag
region
*/
}
module "s3" {
source = "./modules/s3"
vpc_id = module.vpc.vpc_id
/**
bucket_name_tag
bucket_name
*/
}
module "instances" {
source = "./modules/instances"
count = 4
node_index = count.index
ssh_key_name = module.security.ssh_key_name
internal_subnet = module.vpc.internal_subnets[count.index]
internal_sec_groups = [module.security.internal_sec_group_id]
user_data_base64 = module.user_data[count.index].polygon_edge_node
instance_iam_role = module.security.ec2_to_assm_iam_policy_id
az = module.vpc.av_zones[count.index]
depends_on = [module.bastion_instance.instance_dns_name]
/**
instance_type
user_data_base64
ebs_root_name_tag
instance_name
instance_interface_name_tag
chain_data_ebs_volume_size
chain_data_ebs_name_tag
*/
}
module "bastion_instance" {
source = "./modules/instances"
ssh_key_name = module.security.ssh_key_name
internal_subnet = module.vpc.external_subnets[0]
internal_sec_groups = [module.security.bastion_public_id]
instance_iam_role = module.security.ec2_to_assm_iam_policy_id
instance_name = "Polygon_Edge_Bastion"
instance_type = "t2.micro"
polygon_edge_instance_type = false
user_data_base64 = module.user_data[0].bastion
}
module "user_data" {
source = "./modules/user-data"
count = 4
node_name = "node${count.index}"
controller_dns = module.bastion_instance.instance_dns_name
// Chain options
premine = var.premine
// Server non-required options
/**
max_slots
block_time
prometheus_address
block_gas_target
nat_address
dns_name
price_limit
*/
// Chain non-required options
/**
chain_name
chain_id
block_gas_limit
epoch_size
*/
/**
total_nodes
polygon_edge_dir
ebs_device
assm_path
assm_region
s3_bucket_name
*/
}
module "alb" {
source = "./modules/alb"
public_subnets = module.vpc.external_subnets
alb_sec_group = module.security.jsonrpc_sec_group_id
vpc_id = module.vpc.vpc_id
node_ids = module.instances[*].instance_ids
/**
nodes_nlb_name
nodes_nlg_name_tag
nodes_nlb_targetgroup_name
nodes_nlb_targetgroup_port
nodes_nlb_targetgroup_proto
nodes_nlb_listener_port
*/
}