Skip to content

Commit 2986395

Browse files
committed
Add migration instructions to doc
1 parent 25e09da commit 2986395

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/upgrading_to_v5.0.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,37 @@ release.
55

66
## Migration Instructions
77

8+
### Resource simplification
9+
The `google_container_cluster` and `google_container_node_pool` resources previously were different between regional and zonal clusters. They have now been collapsed into a single resource using the `location` variable.
10+
11+
If you are using regional clusters, no migration is needed. If you are using zonal clusters, a state migration is needed. You can use a [script](../helpers/migrate.py) we provided to determine the required state changes:
12+
13+
1. Download the script
14+
15+
```
16+
curl -O https://raw.githubusercontent.com/terraform-google-modules/terraform-google-kubernetes-engine/v5.0.0/helpers/migrate.py
17+
chmod +x migrate.py
18+
```
19+
20+
2. Execute the migration script
21+
22+
```
23+
./migrate.py
24+
```
25+
26+
Output will be similar to the following:
27+
```
28+
---- Migrating the following modules:
29+
-- module.gke-cluster-dev.module.gke
30+
---- Commands to run:
31+
terraform state mv -state terraform.tfstate "module.gke-cluster-dev.module.gke.google_container_cluster.zonal_primary[0]" "module.gke-cluster-dev.module.gke.google_container_cluster.primary[0]"
32+
terraform state mv "module.gke-cluster-dev.module.gke.google_container_node_pool.zonal_pools[0]" "module.gke-cluster-dev.module.gke.google_container_node_pool.pools[0]"
33+
```
34+
35+
3. Execute the provided state migration commands (backups are automatically created).
36+
37+
4. Run `terraform plan` to confirm no changes are expected.
38+
839
### Service Account creation
940
1041
Previously, if you explicitly specified a Service Account using the `service_account` variable on the module this was sufficient to force that Service Account to be used.

0 commit comments

Comments
 (0)