Skip to content

Commit

Permalink
AWS deploy: filter all .tf files through terraform fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
panchoh committed Feb 28, 2019
1 parent f49efdf commit 93f58ad
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 131 deletions.
113 changes: 55 additions & 58 deletions deploy/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data "aws_iam_policy_document" "CloudWatchLogsFullAccess-assume-role-policy" {
}

resource "aws_iam_role" "CloudWatchLogsFullAccess" {
name = "CloudWatchLogsFullAccess"
name = "CloudWatchLogsFullAccess"
assume_role_policy = "${data.aws_iam_policy_document.CloudWatchLogsFullAccess-assume-role-policy.json}"
}

Expand All @@ -41,98 +41,95 @@ resource "aws_iam_instance_profile" "qed-profile" {
module "qed" {
source = "./modules/qed"

name = "qed"
count = 3
instance_type = "t3.2xlarge"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
name = "qed"
count = 3
instance_type = "t3.2xlarge"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
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}"
subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
}

module "inmemory-storage" {
source = "./modules/inmemory_storage"

name = "inmemory-storage"
instance_type = "t3.small"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
name = "inmemory-storage"
instance_type = "t3.small"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
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}"
subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
}

module "agent-publisher" {
source = "./modules/qed"

name = "agent-publisher"
instance_type = "t3.small"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
name = "agent-publisher"
instance_type = "t3.small"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
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}"
role = "publisher"

subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
role = "publisher"
}

module "agent-monitor" {
source = "./modules/qed"

name = "agent-monitor"
count = 1
instance_type = "t3.small"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
name = "agent-monitor"
count = 1
instance_type = "t3.small"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
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}"
role = "monitor"
subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
role = "monitor"
}

module "agent-auditor" {
source = "./modules/qed"

name = "agent-auditor"
instance_type = "t3.small"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
name = "agent-auditor"
instance_type = "t3.small"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
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}"
role = "auditor"

subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
role = "auditor"
}

module "prometheus" {
source = "./modules/prometheus"

instance_type = "t3.medium"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
instance_type = "t3.medium"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
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}"
subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
}

module "riot" {
source = "./modules/riot"

instance_type = "t3.medium"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
instance_type = "t3.medium"
iam_instance_profile = "${aws_iam_instance_profile.qed-profile.name}"
volume_size = "20"
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}"
endpoint = "${module.qed.private_ip[0]}"
num_requests = 10000000

subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
endpoint = "${module.qed.private_ip[0]}"
num_requests = 10000000
}
1 change: 1 addition & 0 deletions deploy/aws/modules/prometheus/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
output "private_ip" {
value = "${aws_instance.prometheus.private_ip}"
}

output "public_ip" {
value = "${aws_instance.prometheus.public_ip}"
}
2 changes: 2 additions & 0 deletions deploy/aws/modules/prometheus/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ variable "subnet_id" {}
variable "key_name" {}

variable "key_path" {}

variable "role" {
default = "prometheus"
}

variable "path" {
default = "/home/ec2-user/prometheus"
}
1 change: 0 additions & 1 deletion deploy/aws/modules/qed/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ output "private_ip" {
output "public_ip" {
value = "${aws_instance.qed-server.*.public_ip}"
}

3 changes: 1 addition & 2 deletions deploy/aws/modules/qed/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ variable "path" {
}

variable "count" {
default = 1
default = 1
}

variable "command" {
default = "start"
}

105 changes: 54 additions & 51 deletions deploy/aws/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,102 +32,105 @@ data "aws_subnet_ids" "all" {
}

module "security_group" {
source = "terraform-aws-modules/security-group/aws"
source = "terraform-aws-modules/security-group/aws"
version = "2.11.0"

name = "qed"
description = "Security group for QED usage"
vpc_id = "${data.aws_vpc.default.id}"

egress_rules = ["all-all"]
egress_rules = ["all-all"]

ingress_cidr_blocks = ["${chomp(data.http.ip.body)}/32"]
ingress_rules = ["all-icmp", "ssh-tcp" ]
ingress_rules = ["all-icmp", "ssh-tcp"]

ingress_with_cidr_blocks = [
{
from_port = 8800
to_port = 8800
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
from_port = 8800
to_port = 8800
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
},
{
from_port = 8888
to_port = 8888
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
from_port = 8888
to_port = 8888
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
},
{
from_port = 8600
to_port = 8600
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
from_port = 8600
to_port = 8600
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
},
{
from_port = 6060
to_port = 6060
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
from_port = 6060
to_port = 6060
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
},
{
from_port = 9100
to_port = 9100
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
}
from_port = 9100
to_port = 9100
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
},
]

computed_ingress_with_source_security_group_id = [
{
from_port = 0
to_port = 65535
protocol = "tcp"
source_security_group_id = "${module.security_group.this_security_group_id}"
from_port = 0
to_port = 65535
protocol = "tcp"
source_security_group_id = "${module.security_group.this_security_group_id}"
},
{
from_port = 0
to_port = 65535
protocol = "tcp"
source_security_group_id = "${module.prometheus_security_group.this_security_group_id}"
}
from_port = 0
to_port = 65535
protocol = "tcp"
source_security_group_id = "${module.prometheus_security_group.this_security_group_id}"
},
]

number_of_computed_ingress_with_source_security_group_id = 2

}

module "prometheus_security_group" {
source = "terraform-aws-modules/security-group/aws"
source = "terraform-aws-modules/security-group/aws"
version = "2.11.0"

name = "prometheus"
description = "Security group for Prometheus/Grafana usage"
vpc_id = "${data.aws_vpc.default.id}"

egress_rules = ["all-all"]
egress_rules = ["all-all"]

ingress_cidr_blocks = ["${chomp(data.http.ip.body)}/32"]
ingress_rules = ["all-icmp", "ssh-tcp" ]
ingress_rules = ["all-icmp", "ssh-tcp"]

ingress_with_cidr_blocks = [
{
from_port = 9090 # prometheus metrics
to_port = 9090
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
from_port = 9090 # prometheus metrics
to_port = 9090
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
},
{
from_port = 3000 # graphana
to_port = 3000
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
from_port = 3000 # graphana
to_port = 3000
protocol = "tcp"
cidr_blocks = "${chomp(data.http.ip.body)}/32"
},
]

computed_ingress_with_source_security_group_id = [
{
from_port = 0
to_port = 65535
protocol = "tcp"
source_security_group_id = "${module.security_group.this_security_group_id}"
}
from_port = 0
to_port = 65535
protocol = "tcp"
source_security_group_id = "${module.security_group.this_security_group_id}"
},
]
number_of_computed_ingress_with_source_security_group_id = 1

number_of_computed_ingress_with_source_security_group_id = 1
}
4 changes: 1 addition & 3 deletions deploy/aws/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

output "qed" {
value = "${module.qed.public_ip}"
}

output "prometheus" {
value = "${module.prometheus.public_ip}"
}

output "riot" {
value = "${module.riot.public_ip}"
}
Expand All @@ -25,5 +25,3 @@ output "agent-monitor" {
output "agent-auditor" {
value = "${module.agent-auditor.public_ip}"
}


Loading

0 comments on commit 93f58ad

Please sign in to comment.