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

+2-1
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

+2-2
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

+6-4
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

+6
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

+3-3
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

+9-8
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

+6
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

+6-4
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

+35
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

+1-2
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
}

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

+1-2
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
}

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

+1-2
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 = ">= 4.27.0, < 5.0"
20+
source = "hashicorp/google-beta"
2221
}
2322
}
2423
}

examples/deploy_service/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module "gke" {
3838
ip_range_services = var.ip_range_services
3939
create_service_account = false
4040
service_account = var.compute_engine_service_account
41+
deletion_protection = false
4142
}
4243

4344
resource "kubernetes_pod" "nginx-example" {

examples/deploy_service/versions.tf

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
terraform {
1818
required_providers {
1919
google = {
20-
source = "hashicorp/google"
21-
version = "~> 4.0"
20+
source = "hashicorp/google"
2221
}
2322
kubernetes = {
2423
source = "hashicorp/kubernetes"

examples/disable_client_cert/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ module "gke" {
4040
create_service_account = false
4141
service_account = var.compute_engine_service_account
4242
issue_client_certificate = false
43+
deletion_protection = false
4344
}

examples/disable_client_cert/versions.tf

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
terraform {
1818
required_providers {
1919
google = {
20-
source = "hashicorp/google"
21-
version = "~> 4.0"
20+
source = "hashicorp/google"
2221
}
2322
kubernetes = {
2423
source = "hashicorp/kubernetes"

examples/node_pool/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module "gke" {
4040
remove_default_node_pool = false
4141
disable_legacy_metadata_endpoints = false
4242
cluster_autoscaling = var.cluster_autoscaling
43+
deletion_protection = false
4344

4445
node_pools = [
4546
{

examples/node_pool/versions.tf

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ terraform {
2020
source = "hashicorp/google"
2121
}
2222
google-beta = {
23-
source = "hashicorp/google-beta"
24-
version = "~> 4.0"
23+
source = "hashicorp/google-beta"
2524
}
2625
kubernetes = {
2726
source = "hashicorp/kubernetes"

examples/node_pool_update_variant/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ module "gke" {
4848
enable_private_endpoint = true
4949
enable_private_nodes = true
5050
master_ipv4_cidr_block = "172.16.0.0/28"
51+
deletion_protection = false
5152

5253
master_authorized_networks = [
5354
{

examples/node_pool_update_variant/versions.tf

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
terraform {
1818
required_providers {
1919
google = {
20-
source = "hashicorp/google"
21-
version = "~> 4.0"
20+
source = "hashicorp/google"
2221
}
2322
kubernetes = {
2423
source = "hashicorp/kubernetes"

examples/node_pool_update_variant_beta/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module "gke" {
5353
enable_private_endpoint = true
5454
enable_private_nodes = true
5555
master_ipv4_cidr_block = "172.16.0.0/28"
56+
deletion_protection = false
5657

5758
master_authorized_networks = [
5859
{

examples/node_pool_update_variant_beta/versions.tf

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ terraform {
2020
source = "hashicorp/google"
2121
}
2222
google-beta = {
23-
source = "hashicorp/google-beta"
24-
version = "~> 4.0"
23+
source = "hashicorp/google-beta"
2524
}
2625
kubernetes = {
2726
source = "hashicorp/kubernetes"

examples/node_pool_update_variant_public_beta/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ module "gke" {
4949
ip_range_services = var.ip_range_services
5050
create_service_account = false
5151
service_account = var.compute_engine_service_account
52+
deletion_protection = false
5253

5354
master_authorized_networks = [
5455
{

examples/node_pool_update_variant_public_beta/versions.tf

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ terraform {
2020
source = "hashicorp/google"
2121
}
2222
google-beta = {
23-
source = "hashicorp/google-beta"
24-
version = "~> 4.0"
23+
source = "hashicorp/google-beta"
2524
}
2625
kubernetes = {
2726
source = "hashicorp/kubernetes"

examples/private_zonal_with_networking/main.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ provider "kubernetes" {
2424

2525
module "gcp-network" {
2626
source = "terraform-google-modules/network/google"
27-
version = ">= 4.0.1"
27+
version = ">= 7.5"
2828

2929
project_id = var.project_id
3030
network_name = var.network
@@ -75,6 +75,7 @@ module "gke" {
7575
enable_private_endpoint = true
7676
enable_private_nodes = true
7777
master_ipv4_cidr_block = "172.16.0.0/28"
78+
deletion_protection = false
7879

7980
master_authorized_networks = [
8081
{

examples/regional_private_node_pool_oauth_scopes/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module "gke" {
3232
service_account = "create"
3333
remove_default_node_pool = true
3434
disable_legacy_metadata_endpoints = true
35+
deletion_protection = false
3536

3637
master_authorized_networks = [
3738
{

examples/regional_private_node_pool_oauth_scopes/network.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
module "gke-network" {
1818
source = "terraform-google-modules/network/google"
19-
version = ">= 4.0.1"
19+
version = ">= 7.5"
2020

2121
project_id = var.project_id
2222
network_name = "random-gke-network"

examples/regional_private_node_pool_oauth_scopes/versions.tf

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
terraform {
1818
required_providers {
1919
google = {
20-
source = "hashicorp/google"
21-
version = "~> 4.0"
20+
source = "hashicorp/google"
2221
}
2322
google-beta = {
24-
source = "hashicorp/google-beta"
25-
version = "~> 4.0"
23+
source = "hashicorp/google-beta"
2624
}
2725
kubernetes = {
2826
source = "hashicorp/kubernetes"

examples/safer_cluster/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ module "gke" {
6565
firewall_inbound_ports = ["9443", "15017"]
6666
kubernetes_version = random_shuffle.version.result[0]
6767
release_channel = "UNSPECIFIED"
68+
deletion_protection = false
6869

6970
master_authorized_networks = [
7071
{

examples/safer_cluster/network.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
module "gcp-network" {
1818
source = "terraform-google-modules/network/google"
19-
version = ">= 4.0.1"
19+
version = ">= 7.5"
2020

2121
project_id = var.project_id
2222
network_name = local.network_name

examples/safer_cluster/versions.tf

+3-5
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,17 @@ terraform {
1818
required_version = ">= 0.13"
1919
required_providers {
2020
google = {
21-
source = "hashicorp/google"
22-
version = "~> 4.0"
21+
source = "hashicorp/google"
2322
}
2423
google-beta = {
25-
source = "hashicorp/google-beta"
26-
version = "~> 4.0"
24+
source = "hashicorp/google-beta"
2725
}
2826
kubernetes = {
2927
source = "hashicorp/kubernetes"
3028
}
3129
random = {
3230
source = "hashicorp/random"
33-
version = "~> 3.0"
31+
version = ">= 3.0"
3432
}
3533
}
3634
}

0 commit comments

Comments
 (0)