From 84863268a3e62979be80e23c77285f74382a6fac Mon Sep 17 00:00:00 2001 From: Stacey Salamon <111294980+staceysalamon-aiven@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:47:51 +0100 Subject: [PATCH] update: redirect migration instructions to TF docs (#612) --- .../upgrade-aiven-for-caching-to-valkey.md | 2 +- .../howto/update-deprecated-resources.md | 68 --------------- .../howto/upgrade-caching-valkey-terraform.md | 85 ------------------- sidebars.ts | 4 +- static/_redirects | 2 + 5 files changed, 4 insertions(+), 157 deletions(-) delete mode 100644 docs/tools/terraform/howto/update-deprecated-resources.md delete mode 100644 docs/tools/terraform/howto/upgrade-caching-valkey-terraform.md diff --git a/docs/products/caching/howto/upgrade-aiven-for-caching-to-valkey.md b/docs/products/caching/howto/upgrade-aiven-for-caching-to-valkey.md index dc1368307..506063735 100644 --- a/docs/products/caching/howto/upgrade-aiven-for-caching-to-valkey.md +++ b/docs/products/caching/howto/upgrade-aiven-for-caching-to-valkey.md @@ -77,4 +77,4 @@ are recycled, and your service continues to operate as the upgrade completes. ## Related pages -Learn how to [update Terraform configuration and state after upgrading to Valkey™](/docs/tools/terraform/howto/upgrade-caching-valkey-terraform). +Learn how to [update Terraform configuration and state after upgrading to Valkey™](https://registry.terraform.io/providers/aiven/aiven/latest/docs/guides/update-deprecated-resources#update-aiven_redis-resources-after-valkey-upgrade). diff --git a/docs/tools/terraform/howto/update-deprecated-resources.md b/docs/tools/terraform/howto/update-deprecated-resources.md deleted file mode 100644 index b34642741..000000000 --- a/docs/tools/terraform/howto/update-deprecated-resources.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Update deprecated resources ---- - -Migrate from resources that have been deprecated or renamed without destroying existing resources. - -:::tip -Backup your Terraform state file `terraform.tfstate` to use in the case -of a rollback. -::: - -In the following example, the `aiven_database` field is migrated to the -new `aiven_pg_database` field for an Aiven for PostgreSQL® service. - -1. Replace references to the deprecated field with the new field. In - the following file `aiven_database` was replaced with - `aiven_pg_database`: - - ``` - - resource "aiven_database" "mydatabase" { - project = aiven_project.myproject.project - service_name = aiven_pg.mypg.service_name - database_name = "" - } - - - + resource "aiven_pg_database" "mydatabase" { - project = aiven_project.myproject.project - service_name = aiven_pg.mypg.service_name - database_name = "" - } - ``` - -2. List of all resources in the state file: - - ``` - terraform state list - ``` - -3. Remove the resource from the control of Terraform: - - ``` - terraform state rm - ``` - - :::tip - Use the `-dry-run` flag to preview the changes without applying - them. - ::: - -4. Add the resource back to Terraform by importing it as a new - resource: - - ``` - terraform import project_name/service_name/db_name - ``` - -5. Check that the import is going to run as you expect: - - ``` - terraform plan - ``` - -6. Apply the new configuration: - - ``` - terraform apply - ``` diff --git a/docs/tools/terraform/howto/upgrade-caching-valkey-terraform.md b/docs/tools/terraform/howto/upgrade-caching-valkey-terraform.md deleted file mode 100644 index 95fdab9ac..000000000 --- a/docs/tools/terraform/howto/upgrade-caching-valkey-terraform.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: Update Terraform after upgrading Aiven for Caching to Aiven for Valkey™ -sidebar_label: Update Terraform configuration after Valkey upgrade ---- - -Update Terraform configuration and state after upgrading from Aiven for Caching to Aiven for Valkey™. -Ensure your infrastructure setup accurately reflects the upgraded service for -seamless management and deployment. - -## Prerequisites - -- Verify that you have upgraded your Aiven for Caching service to [Aiven for Valkey through the Aiven Console or API](/docs/products/caching/howto/upgrade-aiven-for-caching-to-valkey). -- Ensure you have the latest version of [Terraform](/docs/tools/terraform) installed. -- Review the [Aiven Redis resource documentation](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/redis) - and the [Aiven Valkey resource documentation](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/valkey). - -## Step 1: Modify the Terraform Configuration - - - Replace `aiven_redis` and `aiven_redis_user` resources in your configuration - with `aiven_valkey` and `aiven_valkey_user`. - - Update Aiven for Caching-specific configuration parameters to their - Aiven for Valkey equivalents. For example, change `redis_timeout` to `valkey_timeout`. - - **Example configuration:** - - ```hcl - # Before: Aiven for Caching configuration - resource "aiven_redis" "caching_service" { - project = "PROJECT_NAME" - cloud_name = "CLOUD_REGION" - plan = "PLAN_NAME" - service_name = "SERVICE_NAME" - redis_user_config { - redis_timeout = 300 - } - } - ``` - - ```hcl - # After: Aiven for Valkey configuration - resource "aiven_valkey" "caching_service" { - project = "PROJECT_NAME" - cloud_name = "CLOUD_REGION" - plan = "PLAN_NAME" - service_name = "SERVICE_NAME" - valkey_user_config { - valkey_timeout = 300 - } - } - ``` - -## Step 2: Update the Terraform state - - 1. Import each Aiven for Valkey resource into the Terraform state: - - ```bash - terraform import aiven_valkey.valkey_service PROJECT_NAME/SERVICE_NAME - ``` - - 1. Import users associated with the Aiven for Valkey service. For each user, run: - - ```bash - terraform import aiven_valkey_user.user PROJECT_NAME/SERVICE_NAME/USERNAME - ``` - - 1. Remove any Aiven for Caching resources from the Terraform state to prevent - duplicates: - - ```bash - terraform state rm aiven_redis.caching_service - ``` - -## Step 3: Verify and apply changes - - 1. Run `terraform plan` to confirm that the state and configuration are aligned: - - ```bash - terraform plan - ``` - - 1. Apply the changes to finalize the update: - - ```bash - terraform apply - ``` diff --git a/sidebars.ts b/sidebars.ts index 2fd502923..cea254ce7 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -432,9 +432,7 @@ const sidebars: SidebarsConfig = { ], }, 'tools/terraform/howto/migrate-from-teams-to-groups', - 'tools/terraform/howto/update-deprecated-resources', 'tools/terraform/howto/upgrade-to-opensearch', - 'tools/terraform/howto/upgrade-caching-valkey-terraform', { type: 'category', label: 'PostgreSQL', @@ -1954,7 +1952,7 @@ const sidebars: SidebarsConfig = { items: [ 'products/valkey/reference/advanced-params', 'products/valkey/reference/valkey-metrics-in-prometheus', - ] + ], }, ], }, diff --git a/static/_redirects b/static/_redirects index 537f4f54b..43b90fd3e 100644 --- a/static/_redirects +++ b/static/_redirects @@ -204,6 +204,8 @@ /tools/cli/ticket https://aiven.io/docs/platform/howto/support /tools/terraform/concepts/data-sources https://aiven.io/docs/tools/terraform /tools/terraform/howto/terraform-logging https://aiven.io/docs/tools/terraform +/tools/terraform/howto/update-deprecated-resources https://registry.terraform.io/providers/aiven/aiven/latest/docs/guides/update-deprecated-resources +/tools/terraform/howto/upgrade-caching-valkey-terraform https://registry.terraform.io/providers/aiven/aiven/latest/docs/guides/update-deprecated-resources#update-aiven_redis-resources-after-valkey-upgrade /tools/terraform/howto/vnet-peering-azure https://github.com/Aiven-Open/terraform-example-projects/blob/main/virtual_private_networking/azure_vnet_peering /tools/terraform/howto/vpc-peering-aws https://github.com/Aiven-Open/terraform-example-projects/tree/main/virtual_private_networking/aws_vpc_peering /tools/terraform/howto/vpc-peering-gcp https://github.com/Aiven-Open/terraform-example-projects/tree/main/virtual_private_networking/google_vpc_peering