Skip to content

Commit 425bf93

Browse files
authored
feat!: support maintenance_exclusion (terraform-google-modules#1273)
1 parent 23228a8 commit 425bf93

File tree

34 files changed

+95
-25
lines changed

34 files changed

+95
-25
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Then perform the following commands on the root folder:
161161
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
162162
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
163163
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
164-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
164+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
165165
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
166166
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
167167
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,13 @@ resource "google_container_cluster" "primary" {
265265
exclusion_name = maintenance_exclusion.value.name
266266
start_time = maintenance_exclusion.value.start_time
267267
end_time = maintenance_exclusion.value.end_time
268+
269+
dynamic "exclusion_options" {
270+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
271+
content {
272+
scope = exclusion_options.value
273+
}
274+
}
268275
}
269276
}
270277
}

autogen/main/variables.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ variable "maintenance_start_time" {
109109
}
110110

111111
variable "maintenance_exclusions" {
112-
type = list(object({ name = string, start_time = string, end_time = string }))
112+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
113113
description = "List of maintenance exclusions. A cluster can have up to three"
114114
default = []
115115
}

autogen/safer-cluster/variables.tf.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ variable "maintenance_start_time" {
108108
}
109109

110110
variable "maintenance_exclusions" {
111-
type = list(object({ name = string, start_time = string, end_time = string }))
111+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
112112
description = "List of maintenance exclusions. A cluster can have up to three"
113-
default = []
113+
default = []
114114
}
115115

116116
variable "maintenance_end_time" {

cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ resource "google_container_cluster" "primary" {
146146
exclusion_name = maintenance_exclusion.value.name
147147
start_time = maintenance_exclusion.value.start_time
148148
end_time = maintenance_exclusion.value.end_time
149+
150+
dynamic "exclusion_options" {
151+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
152+
content {
153+
scope = exclusion_options.value
154+
}
155+
}
149156
}
150157
}
151158
}

modules/beta-autopilot-private-cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Then perform the following commands on the root folder:
104104
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
105105
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
106106
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
107-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
107+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
108108
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
109109
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
110110
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

modules/beta-autopilot-private-cluster/cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ resource "google_container_cluster" "primary" {
120120
exclusion_name = maintenance_exclusion.value.name
121121
start_time = maintenance_exclusion.value.start_time
122122
end_time = maintenance_exclusion.value.end_time
123+
124+
dynamic "exclusion_options" {
125+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
126+
content {
127+
scope = exclusion_options.value
128+
}
129+
}
123130
}
124131
}
125132
}

modules/beta-autopilot-private-cluster/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ variable "maintenance_start_time" {
109109
}
110110

111111
variable "maintenance_exclusions" {
112-
type = list(object({ name = string, start_time = string, end_time = string }))
112+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
113113
description = "List of maintenance exclusions. A cluster can have up to three"
114114
default = []
115115
}

modules/beta-autopilot-public-cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Then perform the following commands on the root folder:
9595
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
9696
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
9797
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
98-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
98+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
9999
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
100100
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
101101
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

modules/beta-autopilot-public-cluster/cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ resource "google_container_cluster" "primary" {
120120
exclusion_name = maintenance_exclusion.value.name
121121
start_time = maintenance_exclusion.value.start_time
122122
end_time = maintenance_exclusion.value.end_time
123+
124+
dynamic "exclusion_options" {
125+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
126+
content {
127+
scope = exclusion_options.value
128+
}
129+
}
123130
}
124131
}
125132
}

0 commit comments

Comments
 (0)