Skip to content

Commit

Permalink
Update Readme for Migration to provider v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
outscale-toa committed May 30, 2024
1 parent 1ca482d commit 67613b4
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down

0 comments on commit 67613b4

Please sign in to comment.