Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 09b46bc

Browse files
Kirill Zaborskyketzacoatl
Kirill Zaborsky
authored andcommitted
Merge pull request #279 from fpco/fix-tests-plan
Fix errors visible from make plan in the tests directory
1 parent 7c565c1 commit 09b46bc

File tree

12 files changed

+86
-62
lines changed

12 files changed

+86
-62
lines changed

modules/consul-cluster/main.tf

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
module "agent-asg" {
4545
source = "../asg"
4646
ami = var.ami
47-
azs = ["${var.region}a", "${var.region}c"]
4847
elb_names = var.load_balancers
4948
instance_type = var.instance_type
5049
max_nodes = var.max_nodes

modules/consul-leaders/main.tf

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
module "leader-asg" {
2727
source = "../asg"
2828
ami = var.ami
29-
azs = ["${var.region}a", "${var.region}c"]
3029
elb_names = var.load_balancers
3130
instance_type = var.instance_type
3231
max_nodes = var.max_nodes

modules/elasticsearch/data-nodes.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ data "template_file" "data-node-config" {
154154
cluster_tag = "${var.name_prefix}-elasticsearch-cluster"
155155
extra_config = <<EXTRA_CONFIG
156156
# Only set the region for Elasticsearch 5.x, since it is deprecated in 6.x
157-
${element(split(".", var.elasticsearch_version), 0) < 6 ? "cloud.aws.region: ${data.aws_region.current.name}" : ""}
157+
${tonumber(element(split(".", var.elasticsearch_version), 0)) < 6 ? "cloud.aws.region: ${data.aws_region.current.name}" : ""}
158158
159159
${var.extra_config}
160160
EXTRA_CONFIG

modules/elasticsearch/master-nodes.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ data "template_file" "master-node-config" {
141141
cluster_tag = "${var.name_prefix}-elasticsearch-cluster"
142142
extra_config = <<EXTRA_CONFIG
143143
# Only set the region for Elasticsearch 5.x, since it is deprecated in 6.x
144-
${element(split(".", var.elasticsearch_version), 0) < 6 ? "cloud.aws.region: ${data.aws_region.current.name}" : ""}
144+
${tonumber(element(split(".", var.elasticsearch_version), 0)) < 6 ? "cloud.aws.region: ${data.aws_region.current.name}" : ""}
145145
146146
${var.extra_config}
147147
EXTRA_CONFIG

modules/init-snippet-consul-leader/main.tf

+14-13
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@ data "template_file" "init_snippet" {
1414
template = file("${path.module}/snippet.tpl")
1515

1616
vars = {
17-
cidr_prefix_a = var.cidr_prefix_a
18-
cidr_prefix_c = var.cidr_prefix_c
19-
client_token = var.consul_client_token
20-
consul_webui = var.consul_webui
21-
datacenter = var.datacenter
22-
disable_remote_exec = var.disable_consul_remote_exec
23-
init_prefix = var.init_prefix
24-
init_suffix = var.init_suffix
25-
leader_count = var.leader_count
26-
log_prefix = var.log_prefix
27-
log_level = var.log_level
28-
master_token = var.consul_client_token
29-
secret_key = var.consul_secret_key
17+
bootstrap_pillar_file = var.bootstrap_pillar_file
18+
cidr_prefix_a = var.cidr_prefix_a
19+
cidr_prefix_c = var.cidr_prefix_c
20+
client_token = var.consul_client_token
21+
consul_webui = var.consul_webui
22+
datacenter = var.datacenter
23+
disable_remote_exec = var.disable_consul_remote_exec
24+
init_prefix = var.init_prefix
25+
init_suffix = var.init_suffix
26+
leader_count = var.leader_count
27+
log_prefix = var.log_prefix
28+
log_level = var.log_level
29+
master_token = var.consul_client_token
30+
secret_key = var.consul_secret_key
3031
}
3132
}
3233

modules/init-snippet-consul-leader/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
variable "bootstrap_pillar_file" {
2+
default = "/srv/pillar/bootstrap.sls"
3+
description = "path, to the 'bootstrap' pillar file"
4+
type = string
5+
}
6+
17
variable "cidr_prefix_a" {
28
description = "CIDR block prefix to seed IP details in the formula, subnet a"
39
type = string

modules/kibana/data/setup.tpl.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ service nginx reload
6464
# Create a cron job for checking the status of Kibana and nginx for ELB Health Checks
6565
cat <<EOF > /etc/kibana/status-cronjob.sh
6666
#!/bin/bash
67-
KIBANA_RESPONSE_CODE=\$(curl --write-out %{http_code} --silent --output /dev/null localhost:5601)
68-
NGINX_RESPONSE_CODE=\$(curl --write-out %{http_code} --silent --output /dev/null $LOCAL_DNS:5602)
67+
KIBANA_RESPONSE_CODE=\$(curl --write-out %%{http_code} --silent --output /dev/null localhost:5601)
68+
NGINX_RESPONSE_CODE=\$(curl --write-out %%{http_code} --silent --output /dev/null $LOCAL_DNS:5602)
6969
if [ "\$KIBANA_RESPONSE_CODE" == 200 ] && [ "\$NGINX_RESPONSE_CODE" == 401 ]; then
7070
echo "Status: Good" > /var/www/html/kibana-status/index.html
7171
else

modules/kube-stack/main.tf

-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
# an auto-scaling group for kube controllers
4242
module "controller-asg" {
4343
source = "../asg"
44-
azs = var.availability_zones
4544
ami = var.controller_ami
4645
name_prefix = var.name_prefix == "" ? "" : var.name_prefix
4746
elb_names = [aws_elb.kube-controllers.name]
@@ -90,7 +89,6 @@ END_INIT
9089
module "worker-asg" {
9190
source = "../asg"
9291

93-
azs = var.availability_zones
9492
ami = var.worker_ami
9593
name_prefix = var.name_prefix == "" ? "" : var.name_prefix
9694
iam_profile = var.worker_iam_profile

modules/logstash/data/config.tpl.conf

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ filter {
4242
if [info] {
4343
mutate {
4444
rename => {
45-
"info" => "%{[type]}_info"
45+
"info" => "%%{[type]}_info"
4646
}
4747
}
4848
}
4949
if [index_prefix] {
5050
mutate {
5151
add_field => {
52-
"[@metadata][index_prefix]" => "%{[index_prefix]}"
52+
"[@metadata][index_prefix]" => "%%{[index_prefix]}"
5353
}
5454
remove_field => ["index_prefix"]
5555
}
@@ -59,17 +59,17 @@ output {
5959
if [@metadata][index_prefix] {
6060
elasticsearch {
6161
hosts => ["${elasticsearch_url}"]
62-
index => "%{[@metadata][index_prefix]}-%{+YYYY.MM.dd}"
62+
index => "%%{[@metadata][index_prefix]}-%%{+YYYY.MM.dd}"
6363
}
6464
} else if [@metadata][beat] {
6565
elasticsearch {
6666
hosts => ["${elasticsearch_url}"]
67-
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
67+
index => "%%{[@metadata][beat]}-%%{+YYYY.MM.dd}"
6868
}
6969
} else {
7070
elasticsearch {
7171
hosts => ["${elasticsearch_url}"]
72-
index => "generic-%{+YYYY.MM.dd}"
72+
index => "generic-%%{+YYYY.MM.dd}"
7373
}
7474
}
7575
}

modules/prometheus-server/main.tf

+13-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ module "prometheus-data" {
1515
encrypted = var.data_volume_encrypted
1616
kms_key_id = var.data_volume_kms_key_id
1717
snapshot_id = var.data_volume_snapshot_id
18+
iam_instance_profile_role_name = module.instance_profile.iam_role_name
19+
}
20+
21+
# Data source for the AWS subnet we deploy the EC2 instances into
22+
data "aws_subnet" "server-subnet" {
23+
id = var.subnet_id
24+
}
25+
26+
# Create an IAM Instance profile we can use on EC2, associated with the Prometheus Server ASG
27+
module "instance_profile" {
28+
source = "../iam-instance-profile"
29+
name_prefix = "${var.name}-${data.aws_subnet.server-subnet.availability_zone}"
1830
}
1931

2032
module "prometheus-server" {
@@ -27,7 +39,6 @@ module "prometheus-server" {
2739
instance_type = var.instance_type
2840
ami = var.ami
2941
subnet_ids = [var.subnet_id]
30-
azs = ["${var.region}${var.az}"]
3142
public_ip = var.public_ip
3243
key_name = var.key_name
3344
elb_names = var.load_balancers
@@ -37,7 +48,7 @@ module "prometheus-server" {
3748
root_volume_size = var.root_volume_size
3849

3950
#
40-
iam_profile = module.prometheus-data.iam_profile_id
51+
iam_profile = module.instance_profile.iam_profile_id
4152

4253
user_data = <<END_INIT
4354
#!/bin/bash

modules/single-node-asg/main.tf

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ module "server" {
5757
source = "../asg"
5858

5959
ami = var.ami
60-
azs = [local.az]
6160
elb_names = var.load_balancers
6261
key_name = var.key_name
6362
# The IAM Instance Profile w/ attach_ebs role

0 commit comments

Comments
 (0)