Skip to content

Commit 5486fe9

Browse files
committed
Final v5.0.0 tweaks
1 parent 4461904 commit 5486fe9

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

docs/upgrading_to_v5.0.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,37 @@ If you are using regional clusters, no migration is needed. If you are using zon
4646

4747
1. Download the script
4848

49-
```
49+
```sh
5050
curl -O https://raw.githubusercontent.com/terraform-google-modules/terraform-google-kubernetes-engine/v5.0.0/helpers/migrate.py
5151
chmod +x migrate.py
5252
```
5353

54-
2. Execute the migration script
54+
2. Run the script in dryrun mode to confirm the expected changes:
5555

56-
```
57-
./migrate.py
58-
```
56+
```sh
57+
$ ./migrate.py --dryrun
5958
60-
Output will be similar to the following:
61-
```
6259
---- Migrating the following modules:
6360
-- module.gke-cluster-dev.module.gke
6461
---- Commands to run:
6562
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]"
6663
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]"
6764
```
6865

69-
3. Execute the provided state migration commands (backups are automatically created).
66+
3. Execute the migration script
67+
68+
```sh
69+
$ ./migrate.py
70+
71+
---- Migrating the following modules:
72+
-- module.gke-cluster-dev.module.gke
73+
---- Commands to run:
74+
Move "module.gke-cluster-dev.module.gke.google_container_cluster.zonal_primary[0]" to "module.gke-cluster-dev.module.gke.google_container_cluster.primary[0]"
75+
Successfully moved 1 object(s).
76+
Move "module.gke-cluster-dev.module.gke.google_container_node_pool.zonal_pools[0]" to "module.gke-cluster-dev.module.gke.google_container_node_pool.pools[0]"
77+
Successfully moved 1 object(s).
78+
Move "module.gke-cluster-dev.module.gke.null_resource.wait_for_zonal_cluster" to "module.gke-cluster-dev.module.gke.null_resource.wait_for_cluster"
79+
Successfully moved 1 object(s).
80+
```
7081

7182
4. Run `terraform plan` to confirm no changes are expected.

helpers/migrate.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,6 @@ def main(argv):
300300

301301
def argparser():
302302
parser = argparse.ArgumentParser(description='Migrate Terraform state')
303-
# parser.add_argument('oldstate', metavar='oldstate.json',
304-
# help='The current Terraform state (will not be '
305-
# 'modified)')
306-
# parser.add_argument('newstate', metavar='newstate.json',
307-
# help='The path to the new state file')
308303
parser.add_argument('--dryrun', action='store_true',
309304
help='Print the `terraform state mv` commands instead '
310305
'of running the commands.')

0 commit comments

Comments
 (0)