diff --git a/deploy/aws/main.tf b/deploy/aws/main.tf index 080b44679..80918fa3e 100644 --- a/deploy/aws/main.tf +++ b/deploy/aws/main.tf @@ -27,6 +27,7 @@ module "leader" { vpc_security_group_ids = "${module.security_group.this_security_group_id}" subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}" key_name = "${aws_key_pair.qed.key_name}" + key_path = "${var.keypath}" config = <<-CONFIG --- @@ -52,6 +53,7 @@ module "follower-1" { vpc_security_group_ids = "${module.security_group.this_security_group_id}" subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}" key_name = "${aws_key_pair.qed.key_name}" + key_path = "${var.keypath}" config = <<-CONFIG --- @@ -81,6 +83,7 @@ module "follower-2" { vpc_security_group_ids = "${module.security_group.this_security_group_id}" subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}" key_name = "${aws_key_pair.qed.key_name}" + key_path = "${var.keypath}" config = <<-CONFIG --- @@ -210,6 +213,7 @@ module "prometheus" { vpc_security_group_ids = "${module.prometheus_security_group.this_security_group_id}" subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}" key_name = "${aws_key_pair.qed.key_name}" + key_path = "${var.keypath}" config = <<-CONFIG global: diff --git a/deploy/aws/modules/inmemory_storage/main.tf b/deploy/aws/modules/inmemory_storage/main.tf index 2d24c4b08..e26577f88 100644 --- a/deploy/aws/modules/inmemory_storage/main.tf +++ b/deploy/aws/modules/inmemory_storage/main.tf @@ -60,6 +60,7 @@ resource "aws_instance" "inmemory-storage" { connection { user = "ec2-user" + private_key = "${file("${var.key_path}")}" } } diff --git a/deploy/aws/modules/inmemory_storage/variables.tf b/deploy/aws/modules/inmemory_storage/variables.tf index 49272d91a..a75276baa 100644 --- a/deploy/aws/modules/inmemory_storage/variables.tf +++ b/deploy/aws/modules/inmemory_storage/variables.tf @@ -24,6 +24,8 @@ variable "subnet_id" {} variable "key_name" {} +variable "key_path" {} + variable "name" {} variable "path" { diff --git a/deploy/aws/modules/prometheus/main.tf b/deploy/aws/modules/prometheus/main.tf index 3c13f96b3..9fb7d44d9 100644 --- a/deploy/aws/modules/prometheus/main.tf +++ b/deploy/aws/modules/prometheus/main.tf @@ -59,6 +59,7 @@ resource "aws_instance" "prometheus" { connection { user = "ec2-user" + private_key = "${file("${var.key_path}")}" } } @@ -68,14 +69,15 @@ resource "aws_instance" "prometheus" { connection { user = "ec2-user" + private_key = "${file("${var.key_path}")}" } } user_data = <<-DATA #!/bin/bash - yum install https://dl.grafana.com/oss/release/grafana-5.4.2-1.x86_64.rpm - service grafana-server start + sudo yum install -y https://dl.grafana.com/oss/release/grafana-5.4.2-1.x86_64.rpm + sudo service grafana-server start while [ ! -f ${var.path}/prometheus ]; do sleep 1 # INFO: wait until binary exists @@ -83,7 +85,7 @@ resource "aws_instance" "prometheus" { sleep 1 chmod +x ${var.path}/prometheus - ${var.path}/prometheus --config-file=${var.path}/prometheus.yml + nohup ${var.path}/prometheus --config.file=${var.path}/prometheus.yml & diff --git a/deploy/aws/modules/prometheus/variables.tf b/deploy/aws/modules/prometheus/variables.tf index da0685c33..17be3cd2f 100644 --- a/deploy/aws/modules/prometheus/variables.tf +++ b/deploy/aws/modules/prometheus/variables.tf @@ -24,8 +24,10 @@ variable "subnet_id" {} variable "key_name" {} +variable "key_path" {} + variable "config" {} variable "path" { - default = "/etc/prometheus" + default = "/home/ec2-user/prometheus" } diff --git a/deploy/aws/modules/qed/main.tf b/deploy/aws/modules/qed/main.tf index 15ee5253c..14c7b3734 100644 --- a/deploy/aws/modules/qed/main.tf +++ b/deploy/aws/modules/qed/main.tf @@ -42,7 +42,7 @@ resource "aws_instance" "qed-server" { }] tags { - Name = "qed-${var.name}" + Name = "${var.name}" } @@ -52,6 +52,7 @@ resource "aws_instance" "qed-server" { connection { user = "ec2-user" + private_key = "${file("${var.key_path}")}" } } @@ -61,6 +62,7 @@ resource "aws_instance" "qed-server" { connection { user = "ec2-user" + private_key = "${file("${var.key_path}")}" } } diff --git a/deploy/aws/modules/qed/variables.tf b/deploy/aws/modules/qed/variables.tf index 5813cae15..96ca244af 100644 --- a/deploy/aws/modules/qed/variables.tf +++ b/deploy/aws/modules/qed/variables.tf @@ -24,6 +24,8 @@ variable "subnet_id" {} variable "key_name" {} +variable "key_path" {} + variable "name" {} variable "config" {}