Skip to content

Commit e9de006

Browse files
feat!: add service_external_ips option (terraform-google-modules#1441)
* add service_external_ips option * fixing formatting error Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com>
1 parent ba3dcd0 commit e9de006

File tree

33 files changed

+143
-4
lines changed

33 files changed

+143
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ Then perform the following commands on the root folder:
194194
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | `bool` | `false` | no |
195195
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
196196
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
197+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
197198
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
198199
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
199200
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ resource "google_container_cluster" "primary" {
208208
}
209209
}
210210

211+
dynamic "service_external_ips_config" {
212+
for_each = var.service_external_ips ? [1] : []
213+
content {
214+
enabled = var.service_external_ips
215+
}
216+
}
217+
211218
addons_config {
212219
http_load_balancing {
213220
disabled = !var.http_load_balancing

autogen/main/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

autogen/main/versions.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ terraform {
3838
required_providers {
3939
google = {
4040
source = "hashicorp/google"
41-
version = ">= 4.31.0, < 5.0"
41+
version = ">= 4.35.0, < 5.0"
4242
}
4343
kubernetes = {
4444
source = "hashicorp/kubernetes"

cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ resource "google_container_cluster" "primary" {
109109
}
110110
}
111111

112+
dynamic "service_external_ips_config" {
113+
for_each = var.service_external_ips ? [1] : []
114+
content {
115+
enabled = var.service_external_ips
116+
}
117+
}
118+
112119
addons_config {
113120
http_load_balancing {
114121
disabled = !var.http_load_balancing

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Then perform the following commands on the root folder:
124124
| release\_channel | The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | `string` | `null` | no |
125125
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
126126
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
127+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
127128
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
128129
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
129130
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ resource "google_container_cluster" "primary" {
9494
}
9595
}
9696

97+
dynamic "service_external_ips_config" {
98+
for_each = var.service_external_ips ? [1] : []
99+
content {
100+
enabled = var.service_external_ips
101+
}
102+
}
103+
97104
addons_config {
98105
http_load_balancing {
99106
disabled = !var.http_load_balancing

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ Then perform the following commands on the root folder:
113113
| release\_channel | The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | `string` | `null` | no |
114114
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
115115
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
116+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
116117
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
117118
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
118119
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ resource "google_container_cluster" "primary" {
9494
}
9595
}
9696

97+
dynamic "service_external_ips_config" {
98+
for_each = var.service_external_ips ? [1] : []
99+
content {
100+
enabled = var.service_external_ips
101+
}
102+
}
103+
97104
addons_config {
98105
http_load_balancing {
99106
disabled = !var.http_load_balancing

0 commit comments

Comments
 (0)