Skip to content

Commit 455a93c

Browse files
g-awmalikapeabody
andauthored
fix(TPGv5)!: update to TPG v5 (#1761)
Co-authored-by: Andrew Peabody <[email protected]>
1 parent cbaec18 commit 455a93c

File tree

134 files changed

+346
-208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+346
-208
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ Then perform the following commands on the root folder:
149149
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key\_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key\_name is the name of a CloudKMS key. | `list(object({ state = string, key_name = string }))` | <pre>[<br> {<br> "key_name": "",<br> "state": "DECRYPTED"<br> }<br>]</pre> | no |
150150
| datapath\_provider | 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. | `string` | `"DATAPATH_PROVIDER_UNSPECIFIED"` | no |
151151
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | `number` | `110` | no |
152+
| deletion\_protection | Whether or not to allow Terraform to destroy the cluster. | `bool` | `true` | no |
152153
| description | The description of the cluster | `string` | `""` | no |
153154
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
154155
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | `bool` | `true` | no |
@@ -331,7 +332,7 @@ The [project factory](https://github.com/terraform-google-modules/terraform-goog
331332
- [kubectl](https://github.com/kubernetes/kubernetes/releases) 1.9.x
332333
#### Terraform and Plugins
333334
- [Terraform](https://www.terraform.io/downloads.html) 1.3+
334-
- [Terraform Provider for GCP][terraform-provider-google] v4.51
335+
- [Terraform Provider for GCP][terraform-provider-google] v5
335336
#### gcloud
336337
Some submodules use the [terraform-google-gcloud](https://github.com/terraform-google-modules/terraform-google-gcloud) module. By default, this module assumes you already have gcloud installed in your $PATH.
337338
See the [module](https://github.com/terraform-google-modules/terraform-google-gcloud#downloading) documentation for more information.

autogen/main/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,9 @@ The [project factory](https://github.com/terraform-google-modules/terraform-goog
272272
#### Terraform and Plugins
273273
- [Terraform](https://www.terraform.io/downloads.html) 1.3+
274274
{% if beta_cluster %}
275-
- [Terraform Provider for GCP Beta][terraform-provider-google-beta] v4.51
275+
- [Terraform Provider for GCP Beta][terraform-provider-google-beta] v5
276276
{% else %}
277-
- [Terraform Provider for GCP][terraform-provider-google] v4.51
277+
- [Terraform Provider for GCP][terraform-provider-google] v5
278278
{% endif %}
279279
#### gcloud
280280
Some submodules use the [terraform-google-gcloud](https://github.com/terraform-google-modules/terraform-google-gcloud) module. By default, this module assumes you already have gcloud installed in your $PATH.

autogen/main/cluster.tf.tmpl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ resource "google_container_cluster" "primary" {
3131
project = var.project_id
3232
resource_labels = var.cluster_resource_labels
3333

34-
location = local.location
35-
node_locations = local.node_locations
36-
cluster_ipv4_cidr = var.cluster_ipv4_cidr
37-
network = "projects/${local.network_project_id}/global/networks/${var.network}"
34+
location = local.location
35+
node_locations = local.node_locations
36+
cluster_ipv4_cidr = var.cluster_ipv4_cidr
37+
network = "projects/${local.network_project_id}/global/networks/${var.network}"
38+
deletion_protection = var.deletion_protection
39+
3840
{% if autopilot_cluster != true %}
3941
dynamic "network_policy" {
4042
for_each = local.cluster_network_policy

autogen/main/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,12 @@ variable "notification_config_topic" {
592592
default = ""
593593
}
594594

595+
variable "deletion_protection" {
596+
type = bool
597+
description = "Whether or not to allow Terraform to destroy the cluster."
598+
default = true
599+
}
600+
595601
{% if beta_cluster %}
596602
variable "enable_tpu" {
597603
type = bool

autogen/main/versions.tf.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ terraform {
2424
required_providers {
2525
google = {
2626
source = "hashicorp/google"
27-
version = ">= 4.81.0, < 5.0, !=4.65.0, !=4.65.1"
27+
version = ">= 5.0.0, < 6"
2828
}
2929
google-beta = {
3030
source = "hashicorp/google-beta"
31-
version = ">= 4.81.0, < 5.0, !=4.65.0, !=4.65.1"
31+
version = ">= 5.0.0, < 6"
3232
}
3333
kubernetes = {
3434
source = "hashicorp/kubernetes"
@@ -46,7 +46,7 @@ terraform {
4646
required_providers {
4747
google = {
4848
source = "hashicorp/google"
49-
version = ">= 4.80.0, < 5.0, !=4.65.0, !=4.65.1"
49+
version = ">= 5.0.0, < 6"
5050
}
5151
kubernetes = {
5252
source = "hashicorp/kubernetes"

autogen/safer-cluster/main.tf.tmpl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ module "gke" {
2424
{% else %}
2525
source = "../beta-private-cluster/"
2626
{% endif %}
27-
project_id = var.project_id
28-
name = var.name
29-
description = var.description
30-
regional = var.regional
31-
region = var.region
32-
zones = var.zones
33-
network = var.network
34-
network_project_id = var.network_project_id
27+
project_id = var.project_id
28+
name = var.name
29+
description = var.description
30+
regional = var.regional
31+
region = var.region
32+
zones = var.zones
33+
network = var.network
34+
network_project_id = var.network_project_id
35+
deletion_protection = var.deletion_protection
3536

3637
// We need to enforce a minimum Kubernetes Version to ensure
3738
// that the necessary security features are enabled.

autogen/safer-cluster/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,3 +520,9 @@ variable "workload_config_audit_mode" {
520520
type = string
521521
default = "DISABLED"
522522
}
523+
524+
variable "deletion_protection" {
525+
type = bool
526+
description = "Whether or not to allow Terraform to destroy the cluster."
527+
default = true
528+
}

cluster.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ resource "google_container_cluster" "primary" {
2727
project = var.project_id
2828
resource_labels = var.cluster_resource_labels
2929

30-
location = local.location
31-
node_locations = local.node_locations
32-
cluster_ipv4_cidr = var.cluster_ipv4_cidr
33-
network = "projects/${local.network_project_id}/global/networks/${var.network}"
30+
location = local.location
31+
node_locations = local.node_locations
32+
cluster_ipv4_cidr = var.cluster_ipv4_cidr
33+
network = "projects/${local.network_project_id}/global/networks/${var.network}"
34+
deletion_protection = var.deletion_protection
35+
3436
dynamic "network_policy" {
3537
for_each = local.cluster_network_policy
3638

docs/upgrading_to_v29.0.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,41 @@
22
The v29.0 release of *kubernetes-engine* is a backwards incompatible
33
release.
44

5+
### Google Cloud Platform Provider upgrade
6+
The Terraform Kubernetes Engine Module now requires version 5.0 or higher of the Google Cloud Platform Providers.
7+
8+
```diff
9+
terraform {
10+
required_providers {
11+
google = {
12+
source = "hashicorp/google"
13+
- version = "~> 4.0"
14+
+ version = "~> 5.0"
15+
}
16+
google-beta = {
17+
source = "hashicorp/google-beta"
18+
- version = "~> 4.0"
19+
+ version = "~> 5.0"
20+
}
21+
22+
}
23+
}
24+
```
25+
26+
### Deletion Protection
27+
The Terraform Kubernetes Engine Module now includes the `deletion_protection` option which defaults to `true`. To delete your cluster you should specify it explicitly to `false`:
28+
29+
```diff
30+
module "gke" {
31+
- source = "terraform-google-modules/kubernetes-engine/google"
32+
- version = "~> 28.0"
33+
+ source = "terraform-google-modules/kubernetes-engine/google"
34+
+ version = "~> 29.0"
35+
...
36+
+ deletion_protection = false
37+
}
38+
```
39+
540
### Update variant random ID keepers updated
641

742
The v29.0 release updates the keepers for the update variant modules. This will force a recreation of the nodepools.

examples/acm-terraform-blog-part1/terraform/providers.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
terraform {
1818
required_providers {
1919
google-beta = {
20-
source = "hashicorp/google-beta"
21-
version = ">= 3.73.0"
20+
source = "hashicorp/google-beta"
2221
}
2322
}
2423
}

0 commit comments

Comments
 (0)