diff --git a/README.md b/README.md index 16930e90f..431f26fb1 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,64 @@ - [Go](https://golang.org/doc/install) 1.13 (to build the provider plugin) +## Migration to v1 + +> [!WARNING] +> +> Before you begin using the ```v1``` binary on your Terraform code, make sure to back up your state file. If you are using a local state file, you can simply make a copy of your terraform.tfstate file in your project directory. +> If you are using a remote backend such as an S3 bucket, make sure that you follow the backup procedures for the backend and that you exercise the restore procedure at least once. +> +> Additionally, make sure you back up or version your code as the migration will require some code changes (on Flexible_gpu resource). + +### Step 1: Upgrade provider version + +```sh +terraform { + required_providers { + outscale = { + source = "outscale/outscale" + version = "1.0.0" + } + } +} + +provider "outscale" { + # Configuration options +} +``` + +```sh +terraform init -upgrade +``` + +### Step 2: Edit terraform state and configuration files +#### On Linux +```sh +sed -i '/"block_device_mappings_created": \[/, /\],/d' terraform.tfstate +sed -i '/"flexible_gpu_id": "/, /",/d' terraform.tfstate +sed -i '/"link_public_ip": {/, /},/d' terraform.tfstate +sed -i '/"link_nic": {/, /},/d' terraform.tfstate +sed -i 's/flexible_gpu_id /flexible_gpu_ids/g' *.tf +sed -i '/flexible_gpu_ids /s/= /= \[/' *.tf +sed -i '/outscale_flexible_gpu./s/$/ \]/' *.tf +``` + +#### On MacOS +```sh +sed -i='' '/"block_device_mappings_created": \[/, /\],/d' terraform.tfstate +sed -i='' '/"flexible_gpu_id": "/, /",/d' terraform.tfstate +sed -i='' '/"link_public_ip": {/, /},/d' terraform.tfstate +sed -i='' '/"link_nic": {/, /},/d' terraform.tfstate +sed -i='' 's/flexible_gpu_id /flexible_gpu_ids/g' *.tf +sed -i='' '/flexible_gpu_ids /s/= /= \[/' *.tf +sed -i='' '/outscale_flexible_gpu./s/$/ \]/' *.tf +``` +### Step 3: Refresh configuration to update terraform state + +```sh +terraform refresh +``` + ## Breaking change > **Warning**