Skip to content

Commit

Permalink
Minor updates - Fixing maintenance exclusion (#68)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
mishah334 authored Oct 6, 2022
1 parent c9a3331 commit 170dd43
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
27 changes: 25 additions & 2 deletions node_pools.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -178,6 +184,7 @@ resource "google_container_node_pool" "node_pool_mt" {
}

}

}

## Legacy dynamic pods pool (before dynamic pods blue/green)
Expand All @@ -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
Expand Down Expand Up @@ -261,6 +271,7 @@ resource "google_container_node_pool" "node_pool_dynamic_pods" {
}

}

}

## Blue dynamic pods pool (added 2020-12-16)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -502,6 +519,9 @@ resource "google_container_node_pool" "node_pool_platform" {

lifecycle {
create_before_destroy = true
ignore_changes = [
initial_node_count
]
}
}

Expand Down Expand Up @@ -575,5 +595,8 @@ resource "google_container_node_pool" "node_pool_platform_green" {

lifecycle {
create_before_destroy = true
ignore_changes = [
initial_node_count
]
}
}
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@ variable "maintenance_exclusion" {
end_time = string
exclusion_name = string

exclusion_options = object({
exclusion_options = list(object({
scope = string
})
}))
}))
default = []
}
Expand Down

0 comments on commit 170dd43

Please sign in to comment.