From a05cc2a9cb3184de8e440f86780b13832ac85673 Mon Sep 17 00:00:00 2001 From: Alex Ouzounis Date: Tue, 18 Feb 2020 16:59:41 +0000 Subject: [PATCH] feat: add support new v3 google provider (#21) --- main.tf | 31 +++++++++++++++++-------------- outputs.tf | 2 +- variables.tf | 18 +++++++++++++----- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/main.tf b/main.tf index 3157392..fa5fbbc 100644 --- a/main.tf +++ b/main.tf @@ -21,15 +21,15 @@ locals { resource "google_project_service" "project" { for_each = var.google_apis - project = var.gcloud_project - service = each.value + project = var.gcloud_project + service = each.value disable_dependent_services = false } ## Modules module "gke-cluster" { - source = "github.com/ouzi-dev/gke-terraform.git?ref=v0.5.2" - #source = "../gke-terraform" + source = "github.com/ouzi-dev/gke-terraform.git?ref=v0.6.0" + # source = "../gke-terraform" region = var.gcloud_region project = var.gcloud_project @@ -62,6 +62,9 @@ module "gke-cluster" { enable_calico = var.gke_enable_calico authenticator_groups_security_group = var.gke_authenticator_groups_security_group init_nodes = var.gke_init_nodes + + logging_service = var.logging_service + monitoring_service = var.monitoring_service } locals { @@ -69,12 +72,12 @@ locals { } module "image-build-workers" { - source = "github.com/ouzi-dev/gke-terraform.git//modules/gke-workers?ref=v0.5.2" + source = "github.com/ouzi-dev/gke-terraform.git//modules/gke-workers?ref=v0.5.2" #source = "../gke-terraform/modules/gke-workers" - region = var.gcloud_region + region = var.gcloud_region - gke_cluster_name = var.gke_name - group_name = local.imagebuilder_worker_group_name + gke_cluster_name = var.gke_name + group_name = local.imagebuilder_worker_group_name zones = [ data.google_compute_zones.available.names[0], data.google_compute_zones.available.names[1], @@ -88,13 +91,13 @@ module "image-build-workers" { min_nodes = var.imagebuilder_min_nodes max_nodes = var.imagebuilder_max_nodes init_nodes = "0" -# NO_SCHEDULE, PREFER_NO_SCHEDULE, and NO_EXECUTE. - machine_taints = [ - { "key": "imagebuilderonly", - "value": "true", - "effect": "PREFER_NO_SCHEDULE"} + # NO_SCHEDULE, PREFER_NO_SCHEDULE, and NO_EXECUTE. + machine_taints = [ + { "key" : "imagebuilderonly", + "value" : "true", + "effect" : "PREFER_NO_SCHEDULE" } ] - machine_labels = {"group_name":local.imagebuilder_worker_group_name} + machine_labels = { "group_name" : local.imagebuilder_worker_group_name } } ## Extra resources diff --git a/outputs.tf b/outputs.tf index 5483d76..f64a5f1 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,7 +1,7 @@ # GKE outputs output "cluster_ca_certificate" { - value = module.gke-cluster.cluster_ca_certificate + value = module.gke-cluster.cluster_ca_certificate sensitive = true } diff --git a/variables.tf b/variables.tf index a432873..c85ca7e 100644 --- a/variables.tf +++ b/variables.tf @@ -43,7 +43,7 @@ variable "gke_node_scopes" { "https://www.googleapis.com/auth/devstorage.read_write", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/ndev.clouddns.readwrite" + "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } @@ -162,12 +162,12 @@ variable "base_domain" { type = string } -variable "google_apis"{ +variable "google_apis" { type = set(string) default = [ - "iam.googleapis.com", - "cloudresourcemanager.googleapis.com", - "container.googleapis.com", + "iam.googleapis.com", + "cloudresourcemanager.googleapis.com", + "container.googleapis.com", "compute.googleapis.com", "iamcredentials.googleapis.com", "storage-api.googleapis.com", @@ -180,4 +180,12 @@ variable "google_apis"{ "serviceusage.googleapis.com", "dns.googleapis.com" ] +} + +variable "logging_service" { + default = "logging.googleapis.com/kubernetes" +} + +variable "monitoring_service" { + default = "monitoring.googleapis.com/kubernetes" } \ No newline at end of file