Fix network variables according to BlockScout

This commit is contained in:
Andrew Cravenho 2018-10-03 01:23:05 -04:00
parent de2f4fc967
commit a00d088720
5 changed files with 81 additions and 57 deletions

View File

@ -18,7 +18,6 @@ module "stack" {
chain_trace_endpoint = "${var.chain_trace_endpoint}"
chain_ws_endpoint = "${var.chain_ws_endpoint}"
chain_logo = "${var.chain_logo}"
chain_check_origin = "${var.chain_check_origin}"
chain_coin = "${var.chain_coin}"
chain_network = "${var.chain_network}"
chain_subnetwork = "${var.chain_subnetwork}"

View File

@ -36,58 +36,71 @@ variable "root_block_size" {
variable "chains" {
description = "A map of chain names to urls"
default = {
"sokol" = "https://sokol.poa.network"
"sokol" = "https://sokol-trace.poa.network"
}
}
variable "chain_trace_endpoint" {
description = "A map of chain names to RPC tracing endpoint"
default = {
"sokol" = "https://sokol-trace.poa.network"
}
}
variable "chain_ws_endpoint" {
description = "A map of chain names to Websocket RPC Endpoint"
default = {
"sokol" = "wss://sokol-ws.poa.network/ws"
}
}
variable "chain_jsonrpc_variant" {
description = "The chain JSON RPC variant"
default = "parity"
}
variable "chain_trace_endpoint" {
description = "A RPC tracing RPC endpoint"
default = "https://sokol-trace.poa.network"
}
variable "chain_ws_endpoint" {
description = "A Websocket RPC Endpoint for the chain"
default = "wss://sokol-ws.poa.network/ws"
description = "A map of chain names to JSON RPC variant"
default = {
"sokol" = "parity"
}
}
variable "chain_logo" {
description = "The logo url for the chain"
default = "/images/sokol_logo.svg"
}
variable "chain_check_origin" {
description = "The chain names to the check_origin configuration"
default = "false"
description = "A map of chain names to logo url"
default = {
"sokol" = "/images/sokol_logo.svg"
}
}
variable "chain_coin" {
description = "The coin symbol"
default = "POA"
description = "A map of chain name to coin symbol"
default = {
"sokol" = "POA"
}
}
variable "chain_network" {
description = "The network name"
default = "POA Network"
description = "A map of chain names to network name"
default = {
"sokol" = "POA Network"
}
}
variable "chain_subnetwork" {
description = "The subnetwork name"
default = "Sokol Testnet"
description = "A map of chain names to subnetwork name"
default = {
"sokol" = "Sokol Testnet"
}
}
variable "chain_network_path" {
description = "The network name path"
default = "/poa/sokol"
description = "A map of chain names to network name path"
default = {
"sokol" = "/poa/sokol"
}
}
variable "chain_network_icon" {
description = "The network navigation icon"
default = "_test_network_icon.html"
description = "A map of chain names to network navigation icon"
default = {
"sokol" = "_test_network_icon.html"
}
}
# RDS/Database configuration

View File

@ -29,7 +29,7 @@ resource "aws_ssm_parameter" "ecto_use_ssl" {
resource "aws_ssm_parameter" "ethereum_jsonrpc_variant" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/ethereum_jsonrpc_variant"
value = "${var.chain_jsonrpc_variant}"
value = "${element(values(var.chain_jsonrpc_variant),count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "ethereum_url" {
@ -42,62 +42,55 @@ resource "aws_ssm_parameter" "ethereum_url" {
resource "aws_ssm_parameter" "trace_url" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/trace_url"
value = "${var.chain_trace_endpoint}"
value = "${element(values(var.chain_trace_endpoint),count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "ws_url" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/ws_url"
value = "${var.chain_ws_endpoint}"
value = "${element(values(var.chain_ws_endpoint),count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "logo" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/logo"
value = "${var.chain_logo}"
type = "String"
}
resource "aws_ssm_parameter" "check_origin" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/check_origin"
value = "${var.chain_check_origin}"
value = "${element(values(var.chain_logo),count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "coin" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/coin"
value = "${var.chain_coin}"
value = "${element(values(var.chain_coin),count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "network" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/network"
value = "${var.chain_network}"
value = "${element(values(var.chain_network),count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "subnetwork" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/subnetwork"
value = "${var.chain_subnetwork}"
value = "${element(values(var.chain_subnetwork),count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "network_path" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/network_path"
value = "${var.chain_network_path}"
value = "${element(values(var.chain_network_path),count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "network_icon" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/network_icon"
value = "${var.chain_network_icon}"
value = "${element(values(var.chain_network_icon),count.index)}"
type = "String"
}

View File

@ -86,6 +86,8 @@ resource "aws_autoscaling_group" "explorer" {
"aws_ssm_parameter.db_port",
"aws_ssm_parameter.ethereum_url",
"aws_ssm_parameter.trace_url",
"aws_ssm_parameter.ws_url",
"aws_ssm_parameter.network_path",
]
lifecycle {

View File

@ -8,19 +8,36 @@ variable "dns_zone_name" {}
variable "instance_type" {}
variable "root_block_size" {}
variable "chain_jsonrpc_variant" {}
variable "chain_jsonrpc_variant" {
default = {}
}
variable "chains" {
default = {}
}
variable "chain_trace_endpoint" {}
variable "chain_ws_endpoint" {}
variable "chain_logo" {}
variable "chain_check_origin" {}
variable "chain_coin" {}
variable "chain_network" {}
variable "chain_subnetwork" {}
variable "chain_network_path" {}
variable "chain_network_icon" {}
variable "chain_trace_endpoint" {
default = {}
}
variable "chain_ws_endpoint" {
default = {}
}
variable "chain_logo" {
default = {}
}
variable "chain_coin" {
default = {}
}
variable "chain_network" {
default = {}
}
variable "chain_subnetwork" {
default = {}
}
variable "chain_network_path" {
default = {}
}
variable "chain_network_icon" {
default = {}
}
variable "db_id" {}
variable "db_name" {}