Skip to content

Commit

Permalink
fix: Fix the numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
k3yss committed Aug 14, 2024
1 parent 48a6356 commit d182230
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/pg-migration-guide/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ prep_upgrade_as_destination_db = true
### Step 4.5: Handing the non-migrated settings and syncing state via `terraform`

### Step 0
#### Step 4.5.0
Before altering the state of the source instance we will backup the state so that we can use it later to delete the resources.

```sh
Expand All @@ -104,7 +104,7 @@ $ cp terraform.tfstate migration_postgres14-source/
$ cp main.tf migration_postgres14-source/
```

### Step 1
#### Step 4.5.1
- Go to Users tab and delete the **`<database-admin-user>`**
- Log in to the `destination instance` as the `postgres` user and change the name of the `cloudsqlexternalsync` user to the **`<database-admin-user>`** that we deleted earlier, so that we can use that to connect to the database:

Expand All @@ -114,7 +114,7 @@ ALTER USER "cloudsqlexternalsync" RENAME TO "<database-admin-user>";

Also, via the `google cloud console`, assign a password for the admin user, for simplicity you can keep it the same as the source instance so you don't have to handle imports, the further guide assumes you have used the same password.

### Step 2
#### Step 4.5.2

Modify your source destination's `main.tf` to reflect the new destination instance by changing:
- Change the `database_version` to `"POSTGRES_15"` and
Expand Down Expand Up @@ -142,7 +142,7 @@ module "postgresql" {
}
```

### Step 3
#### Step 4.5.3
Remove the state of the old instance, run the below command:

```sh
Expand All @@ -156,7 +156,7 @@ module.postgresql.data.google_compute_network.vpc
module.postgresql.random_password.admin
```

### Step 4
#### Step 4.5.4
Create an `import.tf` file with the following content:

```hcl
Expand All @@ -178,7 +178,7 @@ import {

`echo "<db-suffix>" | xxd -r -p | base64 | tr '/+' '_-' | tr -d '='`

### Step 5
#### Step 4.5.5

Finally, do a

Expand All @@ -188,7 +188,7 @@ terraform apply
The destination instance should be exactly as with the source PostgreSQL instance, expect backups which we will enable after promotion.


### Step 6
#### Step 4.5.6
Now go to the Database Migration Service and once the replication delay is zero, promote the migration.

![promote-migration](./assets/promote-migration.png)
Expand All @@ -198,7 +198,7 @@ Now go to the Database Migration Service and once the replication delay is zero,

![migration-successful](./assets/successful-migration.png)

### Step 7: Enable backup
#### Step 4.5.7: Enable backup
Disable `prep_upgrade_as_destination_db` flag,

```hcl
Expand All @@ -222,7 +222,7 @@ module "postgresql" {
```
Do a `terraform apply`

# Step 7: Delete all the dangling resources
# Step 5: Delete all the dangling resources

- Delete the Database Migration Service that we used for migration.
![delete-dms](./assets/delete-dms.png)
Expand Down

0 comments on commit d182230

Please sign in to comment.