forked from maticnetwork/terraform-polygon-supernets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
129 lines (115 loc) · 4.41 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
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 {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.58.0"
}
datadog = {
source = "DataDog/datadog"
version = "~> 3.22.0"
}
}
required_version = ">= 1.2.0"
}
module "dns" {
source = "./modules/dns"
base_dn = local.base_dn
region = var.region
fullnode_count = var.fullnode_count
validator_count = var.validator_count
devnet_id = "${module.networking.devnet_id}"
aws_lb_domain = "${module.elb.aws_lb_domain}"
validator_private_ips = module.ec2.validator_private_ips
fullnode_private_ips = module.ec2.fullnode_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
validator_count = var.validator_count
jumpbox_count = var.jumpbox_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
jumpbox_instance_type = var.jumpbox_instance_type
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
fullnode_count = var.fullnode_count
validator_count = var.validator_count
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
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
}
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
]
jumpbox_count = var.jumpbox_count
network_type = local.network_type
deployment_name = var.deployment_name
jumpbox_ssh_access = var.jumpbox_ssh_access
network_acl = var.network_acl
http_rpc_port = var.http_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
jumpbox_primary_network_interface_ids = module.ec2.jumpbox_primary_network_interface_ids
}
module "ssm" {
source = "./modules/ssm"
base_dn = local.base_dn
jumpbox_ssh_access = var.jumpbox_ssh_access
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
}
}
}