Skip to content

Commit

Permalink
Fix terraform file provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
suizman authored and iknite committed Feb 19, 2019
1 parent d0a9444 commit 9393af9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions deploy/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand All @@ -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
---
Expand Down Expand Up @@ -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
---
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions deploy/aws/modules/inmemory_storage/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ resource "aws_instance" "inmemory-storage" {

connection {
user = "ec2-user"
private_key = "${file("${var.key_path}")}"
}
}

Expand Down
2 changes: 2 additions & 0 deletions deploy/aws/modules/inmemory_storage/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ variable "subnet_id" {}

variable "key_name" {}

variable "key_path" {}

variable "name" {}

variable "path" {
Expand Down
8 changes: 5 additions & 3 deletions deploy/aws/modules/prometheus/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ resource "aws_instance" "prometheus" {

connection {
user = "ec2-user"
private_key = "${file("${var.key_path}")}"
}
}

Expand All @@ -68,22 +69,23 @@ 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
done
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 &
Expand Down
4 changes: 3 additions & 1 deletion deploy/aws/modules/prometheus/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 3 additions & 1 deletion deploy/aws/modules/qed/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ resource "aws_instance" "qed-server" {
}]

tags {
Name = "qed-${var.name}"
Name = "${var.name}"
}


Expand All @@ -52,6 +52,7 @@ resource "aws_instance" "qed-server" {

connection {
user = "ec2-user"
private_key = "${file("${var.key_path}")}"
}
}

Expand All @@ -61,6 +62,7 @@ resource "aws_instance" "qed-server" {

connection {
user = "ec2-user"
private_key = "${file("${var.key_path}")}"
}
}

Expand Down
2 changes: 2 additions & 0 deletions deploy/aws/modules/qed/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ variable "subnet_id" {}

variable "key_name" {}

variable "key_path" {}

variable "name" {}

variable "config" {}
Expand Down

0 comments on commit 9393af9

Please sign in to comment.