Add chain config variables

This commit is contained in:
Andrew Cravenho 2018-09-24 21:00:24 -04:00
parent 478cae44b3
commit fdf877164b
5 changed files with 164 additions and 0 deletions

View File

@ -15,6 +15,13 @@ module "stack" {
key_name = "${var.key_name}"
chains = "${var.chains}"
chain_trace_endpoints = "${var.chain_trace_endpoints}"
chain_ws_endpoints = "${var.chain_ws_endpoints}"
chain_logo = "${var.chain_logo}"
chain_css_file = "${var.chain_css_file}"
chain_check_origin = "${var.chain_check_origin}"
chain_coin = "${var.chain_coin}"
chain_network = "${var.chain_network}"
chain_subnetwork = "${var.chain_subnetwork}"
vpc_cidr = "${var.vpc_cidr}"
public_subnet_cidr = "${var.public_subnet_cidr}"

View File

@ -48,6 +48,58 @@ variable "chain_trace_endpoints" {
"sokol" = "https://sokol-trace.poa.network"
}
}
variable "chain_ws_endpoints" {
description = "A map of chain names to websocket urls"
default = {
"sokol" = "wss://sokol-ws.poa.network/ws"
}
}
variable "chain_logo" {
description = "A map of chain names to logo urls"
default = {
"sokol" = "/images/sokol_logo.svg"
}
}
variable "chain_css_file" {
description = "A map of chain names to the css file"
default = {
"sokol" = "sokol_variables"
}
}
variable "chain_check_origin" {
description = "A map of chain names to the check_origin configuration"
default = "['//*.blockscout.com']"
}
variable "chain_coin" {
description = "A map of chain names to the coin name"
default = {
"sokol" = "POA"
}
}
variable "chain_network" {
description = "A map of chain names to the network name"
default = {
"sokol" = "POA Network"
}
}
variable "chain_subnetwork" {
description = "A map of chain names to the subnetwork name"
default = {
"sokol" = "Sokol Testnet"
}
}
# RDS/Database configuration
variable "db_id" {

View File

@ -39,6 +39,54 @@ resource "aws_ssm_parameter" "trace_url" {
value = "${element(values(var.chain_trace_endpoints), count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "ws_url" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chain_ws_endpoints),count.index)}/ws_url"
value = "${element(values(var.chain_ws_endpoints), count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "logo" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chain_logo),count.index)}/logo"
value = "${element(values(var.chain_logo), count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "css_file" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chain_css_file),count.index)}/css_file"
value = "${element(values(var.chain_css_file), 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"
}
resource "aws_ssm_parameter" "coin" {
count = "${length(var.chains)}"
name = "/${var.prefix}/${element(keys(var.chain_coin),count.index)}/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.chain_network),count.index)}/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.chain_subnetwork),count.index)}/subnetwork"
value = "${element(values(var.chain_subnetwork), count.index)}"
type = "String"
}
resource "aws_ssm_parameter" "exq_blocks_concurrency" {
count = "${length(var.chains)}"

View File

@ -15,6 +15,25 @@ variable "chains" {
variable "chain_trace_endpoints" {
default = {}
}
variable "chain_ws_endpoints" {
default = {}
}
variable "chain_logo" {
default = {}
}
variable "chain_css_file" {
default = {}
}
variable "chain_check_origin" {}
variable "chain_coin" {
default = {}
}
variable "chain_network" {
default = {}
}
variable "chain_subnetwork" {
default = {}
}
variable "db_id" {}
variable "db_name" {}

38
terraform.tfvars.example Normal file
View File

@ -0,0 +1,38 @@
region = "us-east-1"
bucket = "poa-terraform-state"
dynamodb_table = "poa-terraform-lock"
key_name = "sokol-test"
prefix = "sokol"
db_password = "qwerty12345"
db_instance_class = "db.m4.xlarge"
db_storage = "120"
alb_ssl_policy = "ELBSecurityPolicy-2016-08"
alb_certificate_arn = "arn:aws:acm:us-east-1:290379793816:certificate/6d1bab74-fb46-4244-aab2-832bf519ab24"
root_block_size = 120
chains = {
"sokol" = "https://sokol.poa.network"
}
chain_trace_endpoints = {
"sokol" = "https://sokol-trace.poa.network"
}
chain_ws_endpoints = {
"sokol" = "wss://sokol-ws.poa.network/ws"
}
chain_logo = {
"sokol" = "/images/sokol_logo.svg"
}
chain_css_file = {
"sokol" = "sokol_variables"
}
chain_check_origin = {
"sokol" = "['//*.blockscout.com']"
}
chain_coin = {
"sokol" = "POA"
}
chain_network = {
"sokol" = "POA Network"
}
chain_subnetwork = {
"sokol" = "Sokol Testnet"
}