Skip to content

Commit

Permalink
Working with dependencies (#15)
Browse files Browse the repository at this point in the history
*  adding clusater name to subnetwork name - in case of multiple clusters in the same workspace

* using "${var.name}" to avid dependencies

* example on multiple clusters

* TOC creation

* CR applied

* Overview

* removing dots

* adding dependencies on network

* removing default version - let gcloud decide on defaults

* tags are no longer defined on cluster level, multi cluster example

* IP convention

* adding network dependency
  • Loading branch information
ezalejski authored and russmedia-devops committed Nov 21, 2018
1 parent 4888bd7 commit 2b0f843
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ module "primary-cluster" {
zones = "${var.google_zones}"
project = "${var.project}"
environment = "${terraform.workspace}"
tags = ["nat-${terraform.workspace}"]
min_master_version = "${var.master_version}"
node_pools = "${var.node_pools}"
}
Expand Down Expand Up @@ -115,7 +114,7 @@ module "secondary-cluster" {
project = "${var.project}"
environment = "${terraform.workspace}"
network = "${google_compute_network.default.name}"
nodes_subnet_ip_cidr_range = "10.102.0.0/24"
nodes_subnet_ip_cidr_range = "10.101.0.0/24"
nodes_subnet_container_ip_cidr_range = "172.21.0.0/16"
nodes_subnet_service_ip_cidr_range = "10.201.0.0/16"
}
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ resource "google_compute_network" "default" {

# Subnet for cluster nodes
resource "google_compute_subnetwork" "nodes-subnet" {
depends_on = ["google_compute_network.default"]
name = "${terraform.workspace}-${var.name}-nodes-subnet"
ip_cidr_range = "${var.nodes_subnet_ip_cidr_range}"
network = "${var.network == "" ? terraform.workspace : var.network}"
Expand Down
6 changes: 3 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ variable "environment" {
}

variable "min_master_version" {
default = "1.10.7-gke.6"
default = ""
description = "Kubernetes master version"
}

variable "nodes_subnet_ip_cidr_range" {
default = "10.101.0.0/24"
default = "10.100.0.0/24"
description = "Cidr range for Kubernetes workers"
}

Expand All @@ -58,7 +58,7 @@ variable "node_pools" {
initial_node_count = 1
min_node_count = 1
max_node_count = 3
version = "1.10.7-gke.6"
version = ""
image_type = "COS"
machine_type = "n1-standard-1"
preemptible = true
Expand Down

0 comments on commit 2b0f843

Please sign in to comment.