From eb7b662fecb694ab5b32981fbb6c3cd47c6fc9fc Mon Sep 17 00:00:00 2001 From: Jason Tevnan Date: Tue, 4 Feb 2020 12:57:29 +0100 Subject: [PATCH 1/3] adds the tier all the way down --- .../prometheus-mysql-scraper/inputs.tf | 11 ++++++++++ .../prometheus-mysql-scraper/service.tf | 22 ++++++++++--------- google-cloud/sql/main.tf | 2 ++ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/google-cloud/kubernetes/prometheus-mysql-scraper/inputs.tf b/google-cloud/kubernetes/prometheus-mysql-scraper/inputs.tf index 861d728..c133d7c 100644 --- a/google-cloud/kubernetes/prometheus-mysql-scraper/inputs.tf +++ b/google-cloud/kubernetes/prometheus-mysql-scraper/inputs.tf @@ -42,3 +42,14 @@ variable "instance_read_only_replica_count" { description = "Number of read only replicas to create" default = 0 } + +variable "instance_tier" { + description = "Tier to be passed on to prometheus" + type = "string" +} + +variable "instance_tier_failover" { + description = "Tier to be passed on to prometheus" + type = "string" + default = "UNSET" +} diff --git a/google-cloud/kubernetes/prometheus-mysql-scraper/service.tf b/google-cloud/kubernetes/prometheus-mysql-scraper/service.tf index a29342b..9481582 100644 --- a/google-cloud/kubernetes/prometheus-mysql-scraper/service.tf +++ b/google-cloud/kubernetes/prometheus-mysql-scraper/service.tf @@ -1,11 +1,12 @@ resource "kubernetes_service" "cloudsql" { metadata { annotations { - prometheus_io_scrape = "persistence" - prometheus_io_environment = "${replace("${replace(var.project,"cabify-","")}","-cloudsql-1","")}" - prometheus_io_service = "${var.service_name}" - prometheus_io_owner = "${var.owner}" - prometheus_io_tier = "${var.tier}" + prometheus_io_scrape = "persistence" + prometheus_io_environment = "${replace("${replace(var.project,"cabify-","")}","-cloudsql-1","")}" + prometheus_io_service = "${var.service_name}" + prometheus_io_owner = "${var.owner}" + prometheus_io_tier = "${var.tier}" + prometheus_io_instance_tier = "${var.instance_tier}" } name = "${kubernetes_replication_controller.cloudsql.metadata.0.name}" @@ -33,11 +34,12 @@ resource "kubernetes_service" "cloudsql-failover" { metadata { annotations { - prometheus_io_scrape = "persistence" - prometheus_io_environment = "${replace(var.project,"cabify-","")}" - prometheus_io_service = "${var.service_name}" - prometheus_io_owner = "${var.owner}" - prometheus_io_tier = "${var.tier}" + prometheus_io_scrape = "persistence" + prometheus_io_environment = "${replace(var.project,"cabify-","")}" + prometheus_io_service = "${var.service_name}" + prometheus_io_owner = "${var.owner}" + prometheus_io_tier = "${var.tier}" + prometheus_io_instance_tier = "${var.instance_tier_read_only_replica == "UNSET" ? var.instance_tier : var.instance_tier_read_only_replica}" } name = "${element(kubernetes_replication_controller.cloudsql-failover.*.metadata.0.name, count.index)}" diff --git a/google-cloud/sql/main.tf b/google-cloud/sql/main.tf index 4bd9edc..ed1cd9e 100644 --- a/google-cloud/sql/main.tf +++ b/google-cloud/sql/main.tf @@ -85,4 +85,6 @@ module "cabify_prometheus_mysql_scraper" { owner = "${var.owner}" tier = "${var.tier}" instance_read_only_replica_count = "${var.instance_read_only_replica_count}" + instance_tier = "${var.instance_tier}" + instance_tier_read_only_replica = "${var.instance_tier_read_only_replica}" } From bafd8b6a1599dd28c00a76293965d163e295edc5 Mon Sep 17 00:00:00 2001 From: Jason Tevnan Date: Tue, 4 Feb 2020 13:03:49 +0100 Subject: [PATCH 2/3] wrong variable name --- google-cloud/kubernetes/prometheus-mysql-scraper/inputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud/kubernetes/prometheus-mysql-scraper/inputs.tf b/google-cloud/kubernetes/prometheus-mysql-scraper/inputs.tf index c133d7c..a49fa6a 100644 --- a/google-cloud/kubernetes/prometheus-mysql-scraper/inputs.tf +++ b/google-cloud/kubernetes/prometheus-mysql-scraper/inputs.tf @@ -48,7 +48,7 @@ variable "instance_tier" { type = "string" } -variable "instance_tier_failover" { +variable "instance_tier_read_only_replica" { description = "Tier to be passed on to prometheus" type = "string" default = "UNSET" From 31e1ad3541563b75953c5869c673c049c03fd3df Mon Sep 17 00:00:00 2001 From: Jason Tevnan Date: Tue, 4 Feb 2020 13:08:01 +0100 Subject: [PATCH 3/3] bumps version --- google-cloud/sql/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud/sql/main.tf b/google-cloud/sql/main.tf index ed1cd9e..dcf5bea 100644 --- a/google-cloud/sql/main.tf +++ b/google-cloud/sql/main.tf @@ -75,7 +75,7 @@ resource "google_sql_database_instance" "google_sql_database_instance-module-rea } module "cabify_prometheus_mysql_scraper" { - source = "git@github.com:cabify/terraform-modules.git//google-cloud/kubernetes/prometheus-mysql-scraper?ref=google-cloud_kubernetes-prometheus-mysql-scraper-v0.1.16" + source = "git@github.com:cabify/terraform-modules.git//google-cloud/kubernetes/prometheus-mysql-scraper?ref=google-cloud_kubernetes-prometheus-mysql-scraper-v0.1.17" service_name = "${var.service_name}" user_name = "${var.user_name}" user_password = "${var.user_password}"