From 170dd433debffbe902e38f5676d6169411212de6 Mon Sep 17 00:00:00 2001 From: Mishal Shah <100714644+mishah334@users.noreply.github.com> Date: Thu, 6 Oct 2022 11:02:56 +0530 Subject: [PATCH] Minor updates - Fixing maintenance exclusion (#68) * Fixing variable. * Adding initial_node_count to ignore_changes list to avoid recreation of node-pools. * Adding initial_node_count to ignore_changes list to avoid recreation of node-pools. * Removign duplicate code. --- node_pools.tf | 27 +++++++++++++++++++++++++-- variables.tf | 4 ++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/node_pools.tf b/node_pools.tf index b679ec3..38ce4f1 100644 --- a/node_pools.tf +++ b/node_pools.tf @@ -24,7 +24,10 @@ resource "google_container_node_pool" "node_pool_mt_green" { lifecycle { create_before_destroy = true - ignore_changes = [name] + ignore_changes = [ + name, + initial_node_count + ] } location = var.zonal_cluster ? local.zone : local.region @@ -114,7 +117,10 @@ resource "google_container_node_pool" "node_pool_mt" { lifecycle { create_before_destroy = true - ignore_changes = [name] + ignore_changes = [ + name, + initial_node_count + ] } location = var.zonal_cluster ? local.zone : local.region @@ -178,6 +184,7 @@ resource "google_container_node_pool" "node_pool_mt" { } } + } ## Legacy dynamic pods pool (before dynamic pods blue/green) @@ -198,6 +205,9 @@ resource "google_container_node_pool" "node_pool_dynamic_pods" { lifecycle { create_before_destroy = true + ignore_changes = [ + initial_node_count + ] } location = var.zonal_cluster ? local.zone : local.region @@ -261,6 +271,7 @@ resource "google_container_node_pool" "node_pool_dynamic_pods" { } } + } ## Blue dynamic pods pool (added 2020-12-16) @@ -281,6 +292,9 @@ resource "google_container_node_pool" "dynamic_blue_node_pool" { lifecycle { create_before_destroy = true + ignore_changes = [ + initial_node_count + ] } location = var.zonal_cluster ? local.zone : local.region @@ -365,6 +379,9 @@ resource "google_container_node_pool" "dynamic_green_node_pool" { lifecycle { create_before_destroy = true + ignore_changes = [ + initial_node_count + ] } location = var.zonal_cluster ? local.zone : local.region @@ -502,6 +519,9 @@ resource "google_container_node_pool" "node_pool_platform" { lifecycle { create_before_destroy = true + ignore_changes = [ + initial_node_count + ] } } @@ -575,5 +595,8 @@ resource "google_container_node_pool" "node_pool_platform_green" { lifecycle { create_before_destroy = true + ignore_changes = [ + initial_node_count + ] } } diff --git a/variables.tf b/variables.tf index 05e2877..edf3271 100644 --- a/variables.tf +++ b/variables.tf @@ -497,9 +497,9 @@ variable "maintenance_exclusion" { end_time = string exclusion_name = string - exclusion_options = object({ + exclusion_options = list(object({ scope = string - }) + })) })) default = [] }