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 Jun 3, 2024
1 parent 1ca482d commit 63ae5f8
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,71 @@
- [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
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 63ae5f8

Please sign in to comment.