Skip to content

insight-w3f/terraform-polkadot-aws-asg

Repository files navigation

terraform-polkadot-aws-asg

Features

This module sets up an autoscaling group on AWS with a launch configuration that is populated with an AMI produced from a packer build all wrapped in a single terraform module.

Terraform Versions

For Terraform v0.12.0+

Usage

See the examples directory for usage.

module "network" {
  source = "github.com/insight-w3f/terraform-polkadot-aws-network.git?ref=master"
}

module "lb" {
  source     = "github.com/insight-w3f/terraform-polkadot-aws-api-lb.git?ref=master"
  subnet_ids = module.network.public_subnets
  vpc_id     = module.network.vpc_id
}

variable "public_key" {}

module "defaults" {
  source = "../.."

  environment = "uat"
  namespace   = "kusama"
  stage       = "test"

  public_key             = var.public_key
  relay_node_ip          = "1.2.3.4"
  relay_node_p2p_address = "stuff.things"
  security_groups        = [module.network.sentry_security_group_id]
  subnet_ids             = module.network.public_subnets
  lb_target_group_arn    = module.lb.lb_target_group_arn
}

Examples

Dependencies

Known Issues

No issue is creating limit on this module.

Providers

Name Version
aws n/a
null n/a
random n/a

Inputs

Name Description Type Default Required
cluster_name The name of the k8s cluster string "" no
consul_enabled Bool to use when Consul is enabled bool false no
create Bool to create the resources bool true no
default_telemetry_enabled n/a bool true no
desired_capacity The desired capacity of asg string 2 no
health_check_port Port number for the health check string "5500" no
iam_instance_profile The instance profile to associate with the asg - leasve blank to create one regionally scoped. string "" no
id The id to give the ami string "" no
instance_type Instance type string "i3.large" no
key_name The name of the preexisting key to be used instead of the local public_key_path string "" no
lc_name The name to give the launch configuration - defaults to 'name' string "" no
logging_filter String for polkadot logging filter string "sync=trace,afg=trace,babe=debug" no
max_size The max size of asg string 10 no
min_size The min size of asg string 0 no
name The name to give the ASG and associated resources string "" no
network_name Which Polkadot chain to join string "kusama" no
network_settings Map of network settings to apply. Use either this or set individual variables. map(map(string)) n/a yes
network_stub The stub name of the Polkadot chain (polkadot = polkadot, kusama = ksmcc3) string "ksmcc3" no
node_exporter_hash SHA256 hash of Node Exporter binary string "b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424" no
node_exporter_password Password for node exporter string "node_exporter_password" no
node_exporter_url URL to Node Exporter binary string "https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz" no
node_exporter_user User for node exporter string "node_exporter_user" no
num_instances Number of instances for ASG number 1 no
polkadot_client_hash SHA256 hash of Polkadot client binary string "c34d63e5d80994b2123a3a0b7c5a81ce8dc0f257ee72064bf06654c2b93e31c9" no
polkadot_client_url URL to Polkadot client binary string "https://github.com/w3f/polkadot/releases/download/v0.7.32/polkadot" no
polkadot_prometheus_port Port number for the Prometheus Metrics exporter built into the Polkadot client string "9610" no
project Name of the project for node name string "project" no
prometheus_enabled Bool to use when Prometheus is enabled bool false no
public_key The public ssh key string "" no
public_key_path A path to the public key string "" no
relay_node_ip Internal IP of Polkadot relay node string "" no
relay_node_p2p_address P2P address of Polkadot relay node string "" no
rpc_api_port Port number for the JSON RPC API string "9933" no
security_groups The ids of the security groups list(string) n/a yes
skip_health_check Bool to skip the health check and give requests while syncing bool false no
ssh_user Username for SSH string "ubuntu" no
subnet_ids The ids of the subnets to deploy into list(string) n/a yes
sync_aws_access_key_id AWS access key ID for SoT sync string "" no
sync_aws_secret_access_key AWS access key for SoT sync string "" no
sync_bucket_uri S3 bucket URI for SoT sync string "" no
tags Tags to give resource map(string) {} no
telemetry_url WSS URL for telemetry string "" no
use_external_lb Bool to switch between public (true) or private (false) bool true no
use_lb Bool to enable use of load balancer bool true no
vpc_id vpc id string n/a yes
wait_for_capacity_timeout A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. (See also Waiting for Capacity below.) Setting this to '0' causes Terraform to skip all Capacity Waiting behavior. string "10m" no
wss_api_port Port number for the Websockets API string "9944" no

Outputs

Name Description
autoscaling_group_arn n/a
autoscaling_group_id n/a
autoscaling_group_name n/a
dns_name n/a
id n/a
lb_arn n/a
lb_id n/a
lb_rpc_target_group_arn n/a
lb_rpc_target_group_id n/a
lb_wss_target_group_arn n/a
lb_wss_target_group_id n/a
name n/a
public_ips n/a
tags n/a
user_data n/a

Testing

This module has been packaged with terratest tests

To run them:

  1. Install Go
  2. Run make test-init from the root of this repo
  3. Run make test again from root

Authors

Module managed by robc-io

Credits

License

Apache 2 Licensed. See LICENSE for full details.

About

Auto-scaling group for polkadot blockchain on AWS

Resources

License

Stars

Watchers

Forks

Packages

No packages published