-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
68 lines (53 loc) · 1.63 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
module "jmeter_master" {
source = "./modules/ec2-instance"
instance_count = 1
name = "${var.name}-master"
key_name = aws_key_pair.this.key_name
ami = var.ami
instance_type = var.instance_type
subnet_id = var.subnet_id
subnet_ids = var.subnet_ids
vpc_security_group_ids = [aws_security_group.jmeter.id]
associate_public_ip_address = true
user_data_base64 = base64encode(local.master_user_data)
root_block_device = [
{
volume_type = "gp2"
volume_size = 40
},
]
tags = {
"Role" = "Master"
}
}
module "jmeter_slave" {
source = "./modules/ec2-instance"
instance_count = var.slaves_instance_count
name = "${var.name}-slave"
key_name = aws_key_pair.this.key_name
ami = var.ami
instance_type = var.instance_type
subnet_id = var.subnet_id
subnet_ids = var.subnet_ids
vpc_security_group_ids = [aws_security_group.jmeter.id]
associate_public_ip_address = true
user_data_base64 = base64encode(local.slave_user_data)
root_block_device = [
{
volume_type = "gp2"
volume_size = 40
},
]
tags = {
"Role" = "Slave"
}
}
module "load_test" {
source = "./modules/load-test"
source_jmx = var.source_jmx
host = module.jmeter_master.public_ip[0]
private_key = tls_private_key.this.private_key_pem
slave_ips = join(",", module.jmeter_slave.private_ip)
user = var.user
port = var.port
}