|
@@ -22,14 +22,21 @@ module "nodes" {
|
|
region = var.region
|
|
region = var.region
|
|
profile = var.profile
|
|
profile = var.profile
|
|
open-nets = ["76.14.80.208/32"]
|
|
open-nets = ["76.14.80.208/32"]
|
|
|
|
+<<<<<<< HEAD
|
|
data-node-count = 3
|
|
data-node-count = 3
|
|
re-volume-size = 500
|
|
re-volume-size = 500
|
|
re-instance-type = "m5.xlarge"
|
|
re-instance-type = "m5.xlarge"
|
|
|
|
+=======
|
|
|
|
+ data-node-count = 5
|
|
|
|
+ re-volume-size = 250
|
|
|
|
+ re-instance-type = "m5.4xlarge"
|
|
|
|
+>>>>>>> 650c625a384961385a2361e14ba70eeeceb21a30
|
|
vpc-cidr = var.vpc-cidr
|
|
vpc-cidr = var.vpc-cidr
|
|
vpc-azs = var.vpc-azs
|
|
vpc-azs = var.vpc-azs
|
|
vpc-name = var.vpc-name
|
|
vpc-name = var.vpc-name
|
|
vpc-id = module.vpc.vpc-id
|
|
vpc-id = module.vpc.vpc-id
|
|
vpc-subnets = module.vpc.subnets-public
|
|
vpc-subnets = module.vpc.subnets-public
|
|
|
|
+ allow-public-ssh = 1
|
|
enable-flash = true
|
|
enable-flash = true
|
|
common-tags = {
|
|
common-tags = {
|
|
"Owner" = "maguec"
|
|
"Owner" = "maguec"
|
|
@@ -37,6 +44,7 @@ module "nodes" {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
module "tmuxer" {
|
|
module "tmuxer" {
|
|
source = "../tfmodule-cloud-tmux"
|
|
source = "../tfmodule-cloud-tmux"
|
|
ssh-key = "${var.vpc-name}.pem"
|
|
ssh-key = "${var.vpc-name}.pem"
|
|
@@ -57,4 +65,87 @@ module "dns-lb" {
|
|
"Owner" = "maguec"
|
|
"Owner" = "maguec"
|
|
"Project" = "AWS Testing Environment"
|
|
"Project" = "AWS Testing Environment"
|
|
}
|
|
}
|
|
|
|
+=======
|
|
|
|
+module "tmux" {
|
|
|
|
+ source = "../tfmodule-cloud-tmux"
|
|
|
|
+ session-name = "cpredis"
|
|
|
|
+ ssh-key = "${var.vpc-name}.pem"
|
|
|
|
+ user = "ubuntu"
|
|
|
|
+ nodes = concat(module.nodes.node-ips, [aws_eip.re-eip.public_ip])
|
|
|
|
+ outpath = "${path.module}"
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+# Start CP Redis Testernode
|
|
|
|
+
|
|
|
|
+resource "aws_instance" "re" {
|
|
|
|
+ ami = data.aws_ami.re-ami.id
|
|
|
|
+ instance_type = "m5.4xlarge"
|
|
|
|
+ availability_zone = "${element(var.vpc-azs, 1)}"
|
|
|
|
+ subnet_id = "${element(module.vpc.subnets-public, 1)}"
|
|
|
|
+ vpc_security_group_ids = [module.nodes.re-security-group]
|
|
|
|
+ source_dest_check = false
|
|
|
|
+ key_name = var.vpc-name
|
|
|
|
+ tags = merge({ Name = "Tester-${var.vpc-name}-1" }, var.common-tags)
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+resource "aws_eip" "re-eip" {
|
|
|
|
+ vpc = true
|
|
|
|
+ tags = merge({ Name = "${var.vpc-name}-node-eip-1" }, var.common-tags)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+resource "aws_eip_association" "re-eip-assoc" {
|
|
|
|
+ instance_id = "${element(aws_instance.re.*.id, 1)}"
|
|
|
|
+ allocation_id = "${element(aws_eip.re-eip.*.id, 1)}"
|
|
|
|
+ depends_on = ["aws_instance.re", "aws_eip.re-eip"]
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+resource "null_resource" "remote-config" {
|
|
|
|
+ provisioner "remote-exec" {
|
|
|
|
+ connection {
|
|
|
|
+ user = "ubuntu"
|
|
|
|
+ host = aws_eip.re-eip.public_ip
|
|
|
|
+ private_key = "${file("~/.ssh/${var.vpc-name}.pem")}"
|
|
|
|
+ agent = true
|
|
|
|
+ }
|
|
|
|
+ inline = ["sudo apt update > /dev/null && sudo apt install -y python python-pip > /dev/null"]
|
|
|
|
+ }
|
|
|
|
+ depends_on = ["aws_instance.re", "aws_eip_association.re-eip-assoc"]
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+output "node-ips" {
|
|
|
|
+ value = formatlist("ssh -i ~/.ssh/${var.vpc-name}.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@%s", module.nodes.node-ips)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+output "tester-ips" {
|
|
|
|
+ value = formatlist("ssh -i ~/.ssh/${var.vpc-name}.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@%s", aws_eip.re-eip.public_ip)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+output "tmux" {
|
|
|
|
+ value = "run ./cloud-tmux to enable tmux connections"
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+data "template_file" "raft_group_setup" {
|
|
|
|
+ template = "${file("${path.module}/raft_group_setup.tpl")}"
|
|
|
|
+ vars = {
|
|
|
|
+ node1 = module.nodes.node-internal-ips[0]
|
|
|
|
+ node2 = module.nodes.node-internal-ips[1]
|
|
|
|
+ node3 = module.nodes.node-internal-ips[2]
|
|
|
|
+ node4 = module.nodes.node-internal-ips[3]
|
|
|
|
+ node5 = module.nodes.node-internal-ips[4]
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+resource "null_resource" "raft_group_setup" {
|
|
|
|
+ provisioner "local-exec" {
|
|
|
|
+ command = "echo \"${data.template_file.raft_group_setup.rendered}\" > ${path.module}/ansible/raft_group_setup"
|
|
|
|
+ }
|
|
|
|
+ depends_on = ["data.template_file.raft_group_setup"]
|
|
|
|
+>>>>>>> 650c625a384961385a2361e14ba70eeeceb21a30
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|