Skip to content

Commit 03ca274

Browse files
committed
examples: add load-test end-to-end example
fixes #40
1 parent 0fad4ce commit 03ca274

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

examples/load-test/main.tf

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
terraform {
2+
required_providers {
3+
scylladbcloud = {
4+
source = "registry.terraform.io/scylladb/scylladbcloud"
5+
}
6+
}
7+
}
8+
9+
provider "aws" { }
10+
11+
provider "scylladbcloud" {
12+
token = "..."
13+
}
14+
15+
resource "aws_vpc" "bench" {
16+
cidr_block = "10.0.0.0/16"
17+
}
18+
19+
resource "scylladbcloud_cluster" "mycluster" {
20+
name = "Load Test"
21+
byoa_id = 1002
22+
region = "us-east-1"
23+
node_count = 3
24+
node_type = "i3.xlarge"
25+
cidr_block = "172.31.0.0/16"
26+
27+
enable_vpc_peering = true
28+
enable_dns = true
29+
}
30+
31+
data "scylladbcloud_cql_auth" "mycluster" {
32+
cluster_id = scylladbcloud_cluster.mycluster.cluster_id
33+
}
34+
35+
data "aws_caller_identity" "current" {}
36+
37+
resource "scylladbcloud_vpc_peering" "mycluster" {
38+
cluster_id = scylladbcloud_cluster.mycluster.cluster_id
39+
datacenter = scylladbcloud_cluster.mycluster.datacenter
40+
41+
peer_vpc_id = aws_vpc.bench.id
42+
peer_cidr_block = aws_vpc.bench.cidr_block
43+
peer_region = "us-east-1"
44+
peer_account_id = data.aws_caller_identity.current.account_id
45+
46+
allow_cql = true
47+
}
48+
49+
resource "aws_vpc_peering_connection_accepter" "bench" {
50+
vpc_peering_connection_id = scylladbcloud_vpc_peering.mycluster.connection_id
51+
auto_accept = true
52+
}
53+
54+
resource "aws_route_table" "bench" {
55+
vpc_id = aws_vpc.bench.id
56+
57+
route {
58+
cidr_block = scylladbcloud_cluster.mycluster.cidr_block
59+
vpc_peering_connection_id = aws_vpc_peering_connection_accepter.bench.vpc_peering_connection_id
60+
}
61+
}
62+
63+
module "scylla-bench" {
64+
source = "github.com/rjeczalik/terraform-aws-scylla-bench"
65+
username = data.scylladbcloud_cql_auth.mycluster.username
66+
password = data.scylladbcloud_cql_auth.mycluster.password
67+
seeds = split(",", data.scylladbcloud_cql_auth.mycluster.seeds)
68+
instances = 4
69+
keys = 1000000000
70+
limit = 10000
71+
}

0 commit comments

Comments
 (0)