This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
127 lines (96 loc) · 2.96 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
#####
# Terraform version
#####
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.48.0"
}
}
required_version = ">= 1.0.1"
}
provider "aws" {
region = "${var.region}"
}
#####
# Global params
#####
locals {
# seed
pool_seed_moniker = "seed1-${substr("${var.region}", 0, 2)}"
pool_seed_dns = "seed1.${substr("${var.region}", 0, 2)}.${var.domain_name}"
# node
pool_moniker = "node1-${substr("${var.region}", 0, 2)}"
pool_dns = "node1.${substr("${var.region}", 0, 2)}.${var.domain_name}"
nodes_count = 1
}
#####
# Node
#####
module "node" {
for_each = toset(formatlist("%s", range(local.nodes_count)))
source = "./modules/cheqd_node"
# VPC
cidr_block = var.cidr_block
# Node
moniker = "${local.pool_moniker}"
genesis = var.genesis
node_key = var.node_key
priv_validator_key = var.priv_validator_key
node_args = "--rpc.laddr tcp://0.0.0.0:26657 --p2p.persistent_peers <PEERS_FROM_CHECD_REPO>" # <PEERS_FROM_CHECD_REPO> - Peers need to be copied from https://github.com/cheqd/cheqd-node/blob/main/persistent_chains/testnet/persistent_peers.txt
# Region
availability_zone = "${var.region}a"
region = var.region
# Docker
docker_image_url = var.docker_image_url
# Cloudwatch
cloudwatch_log_region = var.region
email_list = var.email_list
# Load balancer
load_balancer_p2p_port = 26656
load_balancer_rpc_port = 26657
domain_name = "${local.pool_dns}"
route53_zone = var.route53_zone
genesis_arn = ""
node_key_arn = ""
priv_validator_key_arn = ""
}
#####
# Seed Node
#####
module "seed" {
for_each = toset(formatlist("%s", range(local.nodes_count)))
source = "./modules/cheqd_seed_node"
# VPC
cidr_block = var.cidr_block
vpc_id = module.node[0].cheqd_node_vpc_id
public_subnet = module.node[0].cheqd_node_public_subnet_id
public_subnet_2 = module.node[0].cheqd_node_public_subnet_2_id
private_subnet = module.node[0].cheqd_node_private_subnet_id
private_subnet_2 = module.node[0].cheqd_node_private_subnet_2_id
# Node
moniker = "${local.pool_seed_moniker}"
genesis_seed = var.genesis_seed
node_key_seed = var.node_key_seed
priv_validator_key_seed = var.priv_validator_key_seed
# Node Args
node_args = "--rpc.laddr tcp://0.0.0.0:26657 --p2p.seed_mode true --p2p.persistent_peers <PEERS_FROM_CHECD_REPO> --minimum-gas-prices <MIN_GAS>"
# Region
availability_zone = "${var.region}b"
region = var.region
# Docker
docker_image_url = var.docker_image_url
# Cloudwatch
cloudwatch_log_region = var.region
email_list = var.email_list
# Load balancer
load_balancer_p2p_port = 26656
load_balancer_rpc_port = 26657
domain_name = "${local.pool_seed_dns}"
route53_zone = var.route53_zone
lb_logs_s3 = module.node[0].lb_logs_s3_bucket
genesis_seed_arn = ""
node_key_seed_arn = ""
priv_validator_key_seed_arn = ""
}