Skip to content

Commit

Permalink
Fix missing module/qed due to .gitignore misconfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
iknite committed Feb 19, 2019
1 parent f9bd2de commit 0297c07
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ coverage.txt
config.yml
deploy/aws/config_files/*
!deploy/aws/config_files/README.md
!deploy/aws/modules/qed
deploy/aws/modules/inmemory_storage/data
deploy/aws/modules/prometheus/data
2 changes: 0 additions & 2 deletions deploy/aws/modules/prometheus/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ variable "subnet_id" {}

variable "key_name" {}

variable "name" {}

variable "config" {}

variable "path" {
Expand Down
85 changes: 85 additions & 0 deletions deploy/aws/modules/qed/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Copyright 2018 Banco Bilbao Vizcaya Argentaria, S.A.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

data "aws_ami" "amazon_linux" {
most_recent = true

filter {
name = "name"
values = ["amzn-ami-hvm-*-x86_64-gp2"]
}

filter {
name = "owner-alias"
values = ["amazon"]
}
}

resource "aws_instance" "qed-server" {
count = "1"
ami = "${data.aws_ami.amazon_linux.id}"
instance_type = "${var.instance_type}"

vpc_security_group_ids = ["${var.vpc_security_group_ids}"]
subnet_id = "${var.subnet_id}"
associate_public_ip_address = true
key_name = "${var.key_name}"

root_block_device = [{
volume_type = "gp2"
volume_size = "${var.volume_size}"
}]

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


provisioner "file" {
source = "./config_files"
destination = "${var.path}"

connection {
user = "ec2-user"
}
}

provisioner "file" {
content = "${var.config}"
destination = "${var.path}/config.yml"

connection {
user = "ec2-user"
}
}

user_data = <<-DATA
#!/bin/bash
while [ ! -f ${var.path}/qed ]; do
sleep 1 # INFO: wait until binary exists
done
while [ ! -f ${var.path}/config.yml ]; do
sleep 1 # INFO: wait until file exists
done
while [ `lsof ${var.path}/* | wc -l` -gt 0 ]; do
sleep 1 # INFO: prevents Error of `text file busy`
done
chmod +x ${var.path}/qed
${var.path}/qed ${var.command}
DATA
}
8 changes: 8 additions & 0 deletions deploy/aws/modules/qed/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
output "private_ip" {
value = "${aws_instance.qed-server.private_ip}"
}

output "public_ip" {
value = "${aws_instance.qed-server.public_ip}"
}

38 changes: 38 additions & 0 deletions deploy/aws/modules/qed/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Copyright 2018 Banco Bilbao Vizcaya Argentaria, S.A.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

variable "instance_type" {}

variable "volume_size" {}

variable "vpc_security_group_ids" {}

variable "subnet_id" {}

variable "key_name" {}

variable "name" {}

variable "config" {}

variable "path" {
default = "/var/tmp/qed"
}

variable "command" {
default = "start"
}

24 changes: 12 additions & 12 deletions deploy/aws/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ output "follower-1" {
output "follower-2" {
value = "${module.follower-2.public_ip}"
}
output "inmemory-storage" {
value = "${module.inmemory-storage.public_ip}"
}
output "agent-publisher" {
value = "${module.agent-publisher.public_ip}"
}
output "agent-monitor" {
value = "${module.agent-monitor.public_ip}"
}
output "agent-auditor" {
value = "${module.agent-auditor.public_ip}"
}
# output "inmemory-storage" {
# value = "${module.inmemory-storage.public_ip}"
# }
# output "agent-publisher" {
# value = "${module.agent-publisher.public_ip}"
# }
# output "agent-monitor" {
# value = "${module.agent-monitor.public_ip}"
# }
# output "agent-auditor" {
# value = "${module.agent-auditor.public_ip}"
# }

0 comments on commit 0297c07

Please sign in to comment.