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_trace_endpoint = "${var.chain_trace_endpoint}"
chain_ws_endpoint = "${var.chain_ws_endpoint}" chain_ws_endpoint = "${var.chain_ws_endpoint}"
chain_logo = "${var.chain_logo}" chain_logo = "${var.chain_logo}"
chain_check_origin = "${var.chain_check_origin}"
chain_coin = "${var.chain_coin}" chain_coin = "${var.chain_coin}"
chain_network = "${var.chain_network}" chain_network = "${var.chain_network}"
chain_subnetwork = "${var.chain_subnetwork}" chain_subnetwork = "${var.chain_subnetwork}"

View File

@ -36,58 +36,71 @@ variable "root_block_size" {
variable "chains" { variable "chains" {
description = "A map of chain names to urls" description = "A map of chain names to urls"
default = { 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" { variable "chain_jsonrpc_variant" {
description = "The chain JSON RPC variant" description = "A map of chain names to JSON RPC variant"
default = "parity" default = {
} "sokol" = "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"
} }
variable "chain_logo" { variable "chain_logo" {
description = "The logo url for the chain" description = "A map of chain names to logo url"
default = "/images/sokol_logo.svg" default = {
} "sokol" = "/images/sokol_logo.svg"
}
variable "chain_check_origin" {
description = "The chain names to the check_origin configuration"
default = "false"
} }
variable "chain_coin" { variable "chain_coin" {
description = "The coin symbol" description = "A map of chain name to coin symbol"
default = "POA" default = {
"sokol" = "POA"
}
} }
variable "chain_network" { variable "chain_network" {
description = "The network name" description = "A map of chain names to network name"
default = "POA Network" default = {
"sokol" = "POA Network"
}
} }
variable "chain_subnetwork" { variable "chain_subnetwork" {
description = "The subnetwork name" description = "A map of chain names to subnetwork name"
default = "Sokol Testnet" default = {
"sokol" = "Sokol Testnet"
}
} }
variable "chain_network_path" { variable "chain_network_path" {
description = "The network name path" description = "A map of chain names to network name path"
default = "/poa/sokol" default = {
"sokol" = "/poa/sokol"
}
} }
variable "chain_network_icon" { variable "chain_network_icon" {
description = "The network navigation icon" description = "A map of chain names to network navigation icon"
default = "_test_network_icon.html" default = {
"sokol" = "_test_network_icon.html"
}
} }
# RDS/Database configuration # RDS/Database configuration

View File

@ -29,7 +29,7 @@ resource "aws_ssm_parameter" "ecto_use_ssl" {
resource "aws_ssm_parameter" "ethereum_jsonrpc_variant" { resource "aws_ssm_parameter" "ethereum_jsonrpc_variant" {
count = "${length(var.chains)}" count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/ethereum_jsonrpc_variant" 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" type = "String"
} }
resource "aws_ssm_parameter" "ethereum_url" { resource "aws_ssm_parameter" "ethereum_url" {
@ -42,62 +42,55 @@ resource "aws_ssm_parameter" "ethereum_url" {
resource "aws_ssm_parameter" "trace_url" { resource "aws_ssm_parameter" "trace_url" {
count = "${length(var.chains)}" count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/trace_url" 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" type = "String"
} }
resource "aws_ssm_parameter" "ws_url" { resource "aws_ssm_parameter" "ws_url" {
count = "${length(var.chains)}" count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/ws_url" 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" type = "String"
} }
resource "aws_ssm_parameter" "logo" { resource "aws_ssm_parameter" "logo" {
count = "${length(var.chains)}" count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/logo" name = "/${var.prefix}/${element(keys(var.chains),count.index)}/logo"
value = "${var.chain_logo}" value = "${element(values(var.chain_logo),count.index)}"
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}"
type = "String" type = "String"
} }
resource "aws_ssm_parameter" "coin" { resource "aws_ssm_parameter" "coin" {
count = "${length(var.chains)}" count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/coin" name = "/${var.prefix}/${element(keys(var.chains),count.index)}/coin"
value = "${var.chain_coin}" value = "${element(values(var.chain_coin),count.index)}"
type = "String" type = "String"
} }
resource "aws_ssm_parameter" "network" { resource "aws_ssm_parameter" "network" {
count = "${length(var.chains)}" count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/network" name = "/${var.prefix}/${element(keys(var.chains),count.index)}/network"
value = "${var.chain_network}" value = "${element(values(var.chain_network),count.index)}"
type = "String" type = "String"
} }
resource "aws_ssm_parameter" "subnetwork" { resource "aws_ssm_parameter" "subnetwork" {
count = "${length(var.chains)}" count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/subnetwork" name = "/${var.prefix}/${element(keys(var.chains),count.index)}/subnetwork"
value = "${var.chain_subnetwork}" value = "${element(values(var.chain_subnetwork),count.index)}"
type = "String" type = "String"
} }
resource "aws_ssm_parameter" "network_path" { resource "aws_ssm_parameter" "network_path" {
count = "${length(var.chains)}" count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/network_path" 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" type = "String"
} }
resource "aws_ssm_parameter" "network_icon" { resource "aws_ssm_parameter" "network_icon" {
count = "${length(var.chains)}" count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/network_icon" 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" type = "String"
} }

View File

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

View File

@ -8,19 +8,36 @@ variable "dns_zone_name" {}
variable "instance_type" {} variable "instance_type" {}
variable "root_block_size" {} variable "root_block_size" {}
variable "chain_jsonrpc_variant" {} variable "chain_jsonrpc_variant" {
default = {}
}
variable "chains" { variable "chains" {
default = {} default = {}
} }
variable "chain_trace_endpoint" {} variable "chain_trace_endpoint" {
variable "chain_ws_endpoint" {} default = {}
variable "chain_logo" {} }
variable "chain_check_origin" {} variable "chain_ws_endpoint" {
variable "chain_coin" {} default = {}
variable "chain_network" {} }
variable "chain_subnetwork" {} variable "chain_logo" {
variable "chain_network_path" {} default = {}
variable "chain_network_icon" {} }
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_id" {}
variable "db_name" {} variable "db_name" {}