Skip to content

Commit

Permalink
Final v5.0.0 tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante committed Sep 25, 2019
1 parent 4461904 commit 5486fe9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
27 changes: 19 additions & 8 deletions docs/upgrading_to_v5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,37 @@ If you are using regional clusters, no migration is needed. If you are using zon

1. Download the script

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

2. Execute the migration script
2. Run the script in dryrun mode to confirm the expected changes:

```
./migrate.py
```
```sh
$ ./migrate.py --dryrun
Output will be similar to the following:
```
---- Migrating the following modules:
-- module.gke-cluster-dev.module.gke
---- Commands to run:
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]"
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]"
```

3. Execute the provided state migration commands (backups are automatically created).
3. Execute the migration script

```sh
$ ./migrate.py
---- Migrating the following modules:
-- module.gke-cluster-dev.module.gke
---- Commands to run:
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]"
Successfully moved 1 object(s).
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]"
Successfully moved 1 object(s).
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"
Successfully moved 1 object(s).
```

4. Run `terraform plan` to confirm no changes are expected.
5 changes: 0 additions & 5 deletions helpers/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,6 @@ def main(argv):

def argparser():
parser = argparse.ArgumentParser(description='Migrate Terraform state')
# parser.add_argument('oldstate', metavar='oldstate.json',
# help='The current Terraform state (will not be '
# 'modified)')
# parser.add_argument('newstate', metavar='newstate.json',
# help='The path to the new state file')
parser.add_argument('--dryrun', action='store_true',
help='Print the `terraform state mv` commands instead '
'of running the commands.')
Expand Down

0 comments on commit 5486fe9

Please sign in to comment.