Skip to content

blockscout/terraform-for-supernet

Repository files navigation

Module for deploy blockscout to AWS

Examples:
New vpc and deploy database rds:

locals {
  region = "us-east-1"
  tags = {
    terraform_managed = true
    project           = "blockscout-supernet"
  }
}
module "vpc" {
  source = "./aws"
  vpc_name               = "name"
  ssl_certificate_arn    = "<arn>"
  deploy_ec2_instance_db = false
  deploy_rds_db          = true
  tags                   = local.tags
}

!!! For work with existed vpc needs a subnet group: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html#USER_VPC.Subnets
Existed vpc and deploy database rds:

locals {
  region = "us-east-1"
  tags = {
    terraform_managed = true
    project           = "blockscout-supernet"
  }
}
module "vpc" {
  source = "./aws"
  existed_vpc_id = "vpc-05626****"
  existed_private_subnets_ids = ["subnet-*", "subnet-*", "subnet-*"]
  existed_public_subnets_ids = ["subnet-*", "subnet-*", "subnet-*"]
  existed_rds_subnet_group_name = "<name>"
  ssl_certificate_arn = "<arn>"
}

Requirements

Name Version
terraform >= 1.3.0
aws >= 4.64.0
random 3.4.3

Providers

Name Version
aws >= 4.64.0
random 3.4.3

Modules

Name Source Version
alb ./alb n/a
alb_eth_bytecode_db ./alb n/a
alb_sig_provider ./alb n/a
alb_stats ./alb n/a
alb_verifier ./alb n/a
alb_visualizer ./alb n/a
application_sg terraform-aws-modules/security-group/aws 4.16.0
db_sg terraform-aws-modules/security-group/aws 4.16.0
ec2_asg_api_and_ui ./asg n/a
ec2_asg_eth_bytecode_db ./asg n/a
ec2_asg_indexer ./asg n/a
ec2_asg_sig_provider ./asg n/a
ec2_asg_stats ./asg n/a
ec2_asg_verifier ./asg n/a
ec2_asg_visualizer ./asg n/a
ec2_database terraform-aws-modules/ec2-instance/aws 4.2.1
key_pair terraform-aws-modules/key-pair/aws 2.0.1
lb_microservices_sg terraform-aws-modules/security-group/aws 4.16.0
lb_sg terraform-aws-modules/security-group/aws 4.16.0
microservices_sg terraform-aws-modules/security-group/aws 4.16.0
rds terraform-aws-modules/rds/aws 5.1.1
vpc terraform-aws-modules/vpc/aws 3.18.1

Resources

Name Type
random_string.secret_key_base resource
aws_ami.ubuntu data source
aws_availability_zones.current data source
aws_subnet.this data source
aws_subnets.selected data source
aws_vpc.selected data source

Inputs

Name Description Type Default Required
blockscout_settings Settings of blockscout app
object({
postgres_password = optional(string, "postgres")
postgres_user = optional(string, "postgres")
postgres_host = optional(string, "postgres")
blockscout_docker_image = optional(string, "blockscout/blockscout-polygon-supernets:5.1.3-prerelease-61c1238e")
rpc_address = optional(string, "https://rpc-supertestnet.polygon.technology")
chain_id = optional(string, "93201")
rust_verification_service_url = optional(string, "https://sc-verifier.aws-k8s.blockscout.com/")
ws_address = optional(string, "")
visualize_sol2uml_service_url = optional(string, "")
sig_provider_service_url = optional(string, "")
})
{} no
create_iam_instance_profile_ssm_policy Determines whether an IAM instance profile with SSM policy is created or to use an existing IAM instance profile string false no
deploy_ec2_instance_db Create ec2 instance with postgresql db in docker bool true no
deploy_rds_db Enabled deploy rds bool false no
enabled_dns_hostnames Autocreate dns names for ec2 instance in route53. Required for work with default DB bool true no
enabled_nat_gateway Nat gateway enabled bool true no
eth_bytecode_db_create_database Create database in application start bool true no
eth_bytecode_db_docker_image Docker image of eth-bytecode-db string "ghcr.io/blockscout/eth-bytecode-db:main" no
eth_bytecode_db_enabled eth-bytecode-db deploy bool true no
eth_bytecode_db_instance_type AWS instance type string "t2.medium" no
eth_bytecode_db_replicas Number of eth-bytecode-db replicas number 1 no
existed_private_subnets_ids List of existed id private subnets(For instances) list(string) [] no
existed_public_subnets_ids List of existed if public subnets(For LB) list(string) [] no
existed_rds_subnet_group_name Name of subnet group for RDS deploy string "" no
existed_vpc_id Required for using existed vpc. ID of VPC string "" no
iam_instance_profile_arn Amazon Resource Name (ARN) of an existing IAM instance profile. Used when create_iam_instance_profile_ssm_policy = false string null no
image_name OS image mask string "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-202304*" no
image_owner ID of image owner string "679593333241" no
indexer_instance_type AWS instance type string "t2.medium" no
path_docker_compose_files Path in ec2 instance for blockscout files string "/opt/blockscout" no
rds_allocated_storage Size of rds storage number 20 no
rds_instance_type AWS RDS instance type string "db.t3.large" no
rds_max_allocated_storage Max size of rds storage number 300 no
rds_multi_az Creates a primary DB instance and a standby DB instance in a different AZ. Provides high availability and data redundancy, but the standby DB instance doesn't support connections for read workloads. bool false no
sig_provider_docker_image Docker image of sig-provider string "ghcr.io/blockscout/sig-provider:main" no
sig_provider_enabled sig-provider deploy bool false no
sig_provider_instance_type AWS instance type string "t2.medium" no
sig_provider_replicas Number of sig-provider replicas number 1 no
single_nat_gateway Should be true if you want to provision a single shared NAT Gateway across all of your private networks bool true no
ssh_keys Create ssh keys map(string) {} no
ssl_certificate_arn Certificate for ALB string "" no
stats_create_database Create database in application start bool true no
stats_docker_image Docker image of stats string "ghcr.io/blockscout/stats:main" no
stats_enabled stats deploy bool true no
stats_instance_type AWS instance type string "t2.medium" no
stats_replicas Number of stats replicas number 1 no
tags Add custom tags for all resources managed by this script map(string) {} no
ui_and_api_instance_type AWS instance type string "t2.medium" no
user What user to service run as string "root" no
verifier_enabled Verifier deploy bool true no
verifier_instance_type AWS instance type string "t2.medium" no
verifier_replicas Number of verifier replicas number 2 no
verifier_settings Settings of verifier
object({
docker_image = optional(string, "ghcr.io/blockscout/smart-contract-verifier:main")
solidity_fetcher_list_url = optional(string, "https://solc-bin.ethereum.org/linux-amd64/list.json")
solidity_refresh_versions_schedule = optional(string, "0 0 * * * * *")
vyper_fetcher_list_url = optional(string, "https://raw.githubusercontent.com/blockscout/solc-bin/main/vyper.list.json")
vyper_refresh_versions_schedule = optional(string, "0 0 * * * * *")
sourcify_api_url = optional(string, "https://sourcify.dev/server/")
})
{} no
verifier_url Url of verifier string "" no
visualizer_docker_image Docker image of visualizer string "ghcr.io/blockscout/visualizer:latest" no
visualizer_enabled Visualizer deploy bool true no
visualizer_instance_type AWS instance type string "t2.medium" no
visualizer_replicas Number of visualizer replicas number 2 no
vpc_cidr VPC cidr string "10.105.0.0/16" no
vpc_name VPC name string "" no
vpc_private_subnet_cidrs Not required! You can set custom private subnets list(string) null no
vpc_public_subnet_cidrs Not required! You can set custom public subnets list(string) null no

Outputs

Name Description
blockscout_url DNS name of frontend

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published