forked from maticnetwork/terraform-polygon-supernets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
135 lines (121 loc) · 4.63 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
locals {
network_type = "edge"
base_ami = "ami-0ecc74eca1d66d8a6"
base_dn = format("%s.%s.%s.private", var.deployment_name, local.network_type, var.company_name)
base_id = format("%s-%s", var.deployment_name, local.network_type)
}
terraform {
# backend "s3" {}
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.61.0"
}
}
required_version = ">= 1.4.0"
}
module "dns" {
source = "./modules/dns"
base_dn = local.base_dn
region = var.region
fullnode_count = var.fullnode_count
validator_count = var.validator_count
geth_count = var.geth_count
route53_zone_id = var.route53_zone_id
deployment_name = var.deployment_name
devnet_id = module.networking.devnet_id
aws_lb_int_rpc_domain = module.elb.aws_lb_int_rpc_domain
aws_lb_ext_rpc_geth_domain = module.elb.aws_lb_ext_rpc_geth_domain
validator_private_ips = module.ec2.validator_private_ips
fullnode_private_ips = module.ec2.fullnode_private_ips
geth_private_ips = module.ec2.geth_private_ips
}
module "ebs" {
source = "./modules/ebs"
zones = var.zones
node_storage = var.node_storage
validator_count = var.validator_count
fullnode_count = var.fullnode_count
validator_instance_ids = module.ec2.validator_instance_ids
fullnode_instance_ids = module.ec2.fullnode_instance_ids
}
module "ec2" {
source = "./modules/ec2"
base_dn = local.base_dn
base_instance_type = var.base_instance_type
base_ami = local.base_ami
fullnode_count = var.fullnode_count
geth_count = var.geth_count
validator_count = var.validator_count
base_devnet_key_name = format("%s_ssh_key", var.deployment_name)
private_network_mode = var.private_network_mode
network_type = local.network_type
deployment_name = var.deployment_name
create_ssh_key = var.create_ssh_key
devnet_key_value = var.devnet_key_value
devnet_private_subnet_ids = module.networking.devnet_private_subnet_ids
devnet_public_subnet_ids = module.networking.devnet_public_subnet_ids
ec2_profile_name = module.ssm.ec2_profile_name
}
module "elb" {
source = "./modules/elb"
http_rpc_port = var.http_rpc_port
rootchain_rpc_port = var.rootchain_rpc_port
fullnode_count = var.fullnode_count
validator_count = var.validator_count
geth_count = var.geth_count
route53_zone_id = var.route53_zone_id
base_id = local.base_id
devnet_private_subnet_ids = module.networking.devnet_private_subnet_ids
devnet_public_subnet_ids = module.networking.devnet_public_subnet_ids
fullnode_instance_ids = module.ec2.fullnode_instance_ids
validator_instance_ids = module.ec2.validator_instance_ids
geth_instance_ids = module.ec2.geth_instance_ids
devnet_id = module.networking.devnet_id
security_group_open_http_id = module.securitygroups.security_group_open_http_id
security_group_default_id = module.securitygroups.security_group_default_id
certificate_arn = module.dns.certificate_arn
}
module "networking" {
source = "./modules/networking"
base_dn = local.base_dn
devnet_vpc_block = var.devnet_vpc_block
devnet_public_subnet = var.devnet_public_subnet
devnet_private_subnet = var.devnet_private_subnet
zones = var.zones
}
module "securitygroups" {
source = "./modules/securitygroups"
depends_on = [
module.networking
]
network_type = local.network_type
deployment_name = var.deployment_name
network_acl = var.network_acl
http_rpc_port = var.http_rpc_port
rootchain_rpc_port = var.rootchain_rpc_port
devnet_id = module.networking.devnet_id
validator_primary_network_interface_ids = module.ec2.validator_primary_network_interface_ids
fullnode_primary_network_interface_ids = module.ec2.fullnode_primary_network_interface_ids
geth_primary_network_interface_ids = module.ec2.geth_primary_network_interface_ids
geth_count = var.geth_count
}
module "ssm" {
source = "./modules/ssm"
base_dn = local.base_dn
deployment_name = var.deployment_name
network_type = local.network_type
}
provider "aws" {
region = var.region
default_tags {
tags = {
Environment = var.environment
Network = local.network_type
Owner = var.owner
DeploymentName = var.deployment_name
BaseDN = local.base_dn
Name = local.base_dn
}
}
}