Skip to content

Commit

Permalink
examples: add load-test end-to-end example
Browse files Browse the repository at this point in the history
  • Loading branch information
rjeczalik committed Feb 1, 2023
1 parent 0fad4ce commit 8af5b16
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions examples/load-test/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
terraform {
required_providers {
scylladbcloud = {
source = "registry.terraform.io/scylladb/scylladbcloud"
}
}
}

provider "aws" { }

provider "scylladbcloud" {
token = "..."
}

resource "aws_vpc" "bench" {
cidr_block = "10.0.0.0/16"
}

resource "scylladbcloud_cluster" "mycluster" {
name = "Load Test"
byoa_id = 1002
region = "us-east-1"
node_count = 3
node_type = "i3.xlarge"
cidr_block = "172.31.0.0/16"

enable_vpc_peering = true
enable_dns = true
}

data "scylladbcloud_cql_auth" "mycluster" {
cluster_id = scylladbcloud_cluster.mycluster.cluster_id
}

data "aws_caller_identity" "current" {}

resource "scylladbcloud_vpc_peering" "mycluster" {
cluster_id = scylladbcloud_cluster.mycluster.cluster_id
datacenter = scylladbcloud_cluster.mycluster.datacenter

peer_vpc_id = aws_vpc.bench.id
peer_cidr_block = aws_vpc.bench.cidr_block
peer_region = "us-east-1"
peer_account_id = data.aws_caller_identity.current.account_id

allow_cql = true
}

resource "aws_vpc_peering_connection_accepter" "bench" {
vpc_peering_connection_id = scylladbcloud_vpc_peering.mycluster.connection_id
auto_accept = true
}

resource "aws_route_table" "bench" {
vpc_id = aws_vpc.bench.id

route {
cidr_block = scylladbcloud_cluster.mycluster.cidr_block
vpc_peering_connection_id = aws_vpc_peering_connection_accepter.bench.vpc_peering_connection_id
}
}

module "scylla-bench" {
source = "github.com/rjeczalik/terraform-aws-scylla-bench"
username = data.scylladbcloud_cql_auth.mycluster.username
password = data.scylladbcloud_cql_auth.mycluster.password
seeds = split(",", data.scylladbcloud_cql_auth.mycluster.seeds)
instances = 4
keys = 1000000000
limit = 10000

depends_on = [aws_route_table.bench]
}

0 comments on commit 8af5b16

Please sign in to comment.