Skip to content

Commit 11bae67

Browse files
authored
feat: Add secondary_boot_disks to node_pool configuration. (terraform-google-modules#1946)
1 parent 3d5cc9f commit 11bae67

File tree

16 files changed

+143
-0
lines changed

16 files changed

+143
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ The node_pools variable takes the following parameters:
325325
| value | The value for the taint | | Required |
326326
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
327327
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
328+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
328329

329330
## windows_node_pools variable
330331
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

autogen/main/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ The node_pools variable takes the following parameters:
250250
| value | The value for the taint | | Required |
251251
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
252252
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
253+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
253254

254255
## windows_node_pools variable
255256
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

autogen/main/cluster.tf.tmpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,15 @@ resource "google_container_node_pool" "windows_pools" {
864864
}
865865
}
866866

867+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
868+
dynamic "secondary_boot_disks" {
869+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
870+
content {
871+
disk_image = secondary_boot_disks.value
872+
mode = "CONTAINER_IMAGE_CACHE"
873+
}
874+
}
875+
867876
service_account = lookup(
868877
each.value,
869878
"service_account",

cluster.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,15 @@ resource "google_container_node_pool" "pools" {
582582
}
583583
}
584584

585+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
586+
dynamic "secondary_boot_disks" {
587+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
588+
content {
589+
disk_image = secondary_boot_disks.value
590+
mode = "CONTAINER_IMAGE_CACHE"
591+
}
592+
}
593+
585594
service_account = lookup(
586595
each.value,
587596
"service_account",
@@ -798,6 +807,15 @@ resource "google_container_node_pool" "windows_pools" {
798807
}
799808
}
800809

810+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
811+
dynamic "secondary_boot_disks" {
812+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
813+
content {
814+
disk_image = secondary_boot_disks.value
815+
mode = "CONTAINER_IMAGE_CACHE"
816+
}
817+
}
818+
801819
service_account = lookup(
802820
each.value,
803821
"service_account",

modules/beta-private-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ The node_pools variable takes the following parameters:
391391
| value | The value for the taint | | Required |
392392
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
393393
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
394+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
394395

395396
## windows_node_pools variable
396397
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,15 @@ resource "google_container_node_pool" "pools" {
748748
}
749749
}
750750

751+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
752+
dynamic "secondary_boot_disks" {
753+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
754+
content {
755+
disk_image = secondary_boot_disks.value
756+
mode = "CONTAINER_IMAGE_CACHE"
757+
}
758+
}
759+
751760
service_account = lookup(
752761
each.value,
753762
"service_account",
@@ -990,6 +999,15 @@ resource "google_container_node_pool" "windows_pools" {
990999
}
9911000
}
9921001

1002+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
1003+
dynamic "secondary_boot_disks" {
1004+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
1005+
content {
1006+
disk_image = secondary_boot_disks.value
1007+
mode = "CONTAINER_IMAGE_CACHE"
1008+
}
1009+
}
1010+
9931011
service_account = lookup(
9941012
each.value,
9951013
"service_account",

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ The node_pools variable takes the following parameters:
369369
| value | The value for the taint | | Required |
370370
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
371371
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
372+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
372373

373374
## windows_node_pools variable
374375
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

modules/beta-private-cluster/cluster.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,15 @@ resource "google_container_node_pool" "pools" {
673673
}
674674
}
675675

676+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
677+
dynamic "secondary_boot_disks" {
678+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
679+
content {
680+
disk_image = secondary_boot_disks.value
681+
mode = "CONTAINER_IMAGE_CACHE"
682+
}
683+
}
684+
676685
service_account = lookup(
677686
each.value,
678687
"service_account",
@@ -914,6 +923,15 @@ resource "google_container_node_pool" "windows_pools" {
914923
}
915924
}
916925

926+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
927+
dynamic "secondary_boot_disks" {
928+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
929+
content {
930+
disk_image = secondary_boot_disks.value
931+
mode = "CONTAINER_IMAGE_CACHE"
932+
}
933+
}
934+
917935
service_account = lookup(
918936
each.value,
919937
"service_account",

modules/beta-public-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ The node_pools variable takes the following parameters:
379379
| value | The value for the taint | | Required |
380380
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
381381
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
382+
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
382383

383384
## windows_node_pools variable
384385
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

modules/beta-public-cluster-update-variant/cluster.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,15 @@ resource "google_container_node_pool" "pools" {
729729
}
730730
}
731731

732+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
733+
dynamic "secondary_boot_disks" {
734+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
735+
content {
736+
disk_image = secondary_boot_disks.value
737+
mode = "CONTAINER_IMAGE_CACHE"
738+
}
739+
}
740+
732741
service_account = lookup(
733742
each.value,
734743
"service_account",
@@ -971,6 +980,15 @@ resource "google_container_node_pool" "windows_pools" {
971980
}
972981
}
973982

983+
# Supports a single secondary boot disk because `map(any)` must have the same values type.
984+
dynamic "secondary_boot_disks" {
985+
for_each = lookup(each.value, "secondary_boot_disk", "") != "" ? [each.value.secondary_boot_disk] : []
986+
content {
987+
disk_image = secondary_boot_disks.value
988+
mode = "CONTAINER_IMAGE_CACHE"
989+
}
990+
}
991+
974992
service_account = lookup(
975993
each.value,
976994
"service_account",

0 commit comments

Comments
 (0)