diff --git a/README.md b/README.md index 16930e90f..cf67a5f36 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,86 @@ - [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 just 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 and that you exercise the restore procedure at least once. +> +> Additionally, make sure you backup or version your code as 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 + +Somes block types changed in terraform state, the following script will delete those blocks. + +Then ``` terraform refresh``` or ``` terraform apply ``` will set the right block type. + +#### On Linux +```sh +terraform fmt +sed -i '/"block_device_mappings_created": \[/, /\],/d' terraform.tfstate +sed -i 's/outscale_volumes_link/outscale_volume_link/g' terraform.tfstate +sed -i '/"link_public_ip": {/, /},/d' terraform.tfstate +sed -i '/"link_nic": {/, /},/d' terraform.tfstate +sed -i '/"flexible_gpu_id": "/, /",/d' terraform.tfstate +sed -i 's/outscale_volumes_link/outscale_volume_link/g' *.tf +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 +terraform fmt +``` + +#### On MacOS +```sh +terraform fmt +sed -i='' '/"block_device_mappings_created": \[/, /\],/d' terraform.tfstate +sed -i='' 's/outscale_volumes_link/outscale_volume_link/g' terraform.tfstate +sed -i='' '/"link_public_ip": {/, /},/d' terraform.tfstate +sed -i='' '/"link_nic": {/, /},/d' terraform.tfstate +sed -i='' '/"flexible_gpu_id": "/, /",/d' terraform.tfstate +sed -i='' 's/outscale_volumes_link/outscale_volume_link/g' *.tf +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 +terraform fmt +``` +### Step 3: Refresh configuration to update terraform state + +```sh +terraform refresh +``` + ## Breaking change > **Warning** > > We have a broken change on our api when creating access_key without expiration date for all version less then v0.9.0. ([GH-issues](https://github.com/outscale/terraform-provider-outscale/issues/342)) > -> We recommende to upgrade on the latest ([v0.11.0](https://registry.terraform.io/providers/outscale/outscale/latest)) +> We recommend to upgrade on the latest ([v0.11.0](https://registry.terraform.io/providers/outscale/outscale/latest)) ## Using the Provider