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 19, 2024
1 parent e7834ae commit ce8fce5
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 19 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
1.0.0-rc.1 (June 19, 2024)
========================
BUG FIXES:
----------

* Error in attributes value for healthy_threshold ([GH-450](https://github.com/outscale/terraform-provider-outscale/issues/450))

FEATURES:
---------

* Enable adding Tag on boot disk ([GH-110](https://github.com/outscale/terraform-provider-outscale/issues/110))
* Enable linked multiple flexible GPUs to VM ([GH-220](https://github.com/outscale/terraform-provider-outscale/issues/220))

IMPROVEMENT:
-----------
* Rename ``` outscale_volumes_link ``` to ``` outscale_volume_link ```
* Upgrade to Terraform-plugin-sdkv2 and terraform-plugin-framework ([GH-150](https://github.com/outscale/terraform-provider-outscale/issues/150))
* Somes refactoring

0.12.0 (April 13, 2024)
========================
BUG FIXES:
Expand Down
111 changes: 92 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- Website: https://www.terraform.io
- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby)
- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool)
<img alt="Terraform" src="https://camo.githubusercontent.com/1a4ed08978379480a9b1ca95d7f4cc8eb80b45ad47c056a7cfb5c597e9315ae5/68747470733a2f2f7777772e6461746f636d732d6173736574732e636f6d2f323838352f313632393934313234322d6c6f676f2d7465727261666f726d2d6d61696e2e737667" width="200px">
<img alt="Terraform" src="https://camo.githubusercontent.com/6d6ec94bb2909d75122df9cf17e1940b522a805587c890a2e37a57eba61f7eb1/68747470733a2f2f7777772e6461746f636d732d6173736574732e636f6d2f323838352f313632393934313234322d6c6f676f2d7465727261666f726d2d6d61696e2e737667" width="200px">

## Requirements

Expand All @@ -13,13 +13,86 @@
- [Go](https://golang.org/doc/install) 1.22.0 (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-rc.1"
}
}
}

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 recommend to upgrade on the latest ([v0.12.0](https://registry.terraform.io/providers/outscale/outscale/latest))
> We recommend to upgrade on the latest ([v1.0.0-rc.1](https://registry.terraform.io/providers/outscale/outscale/latest))
## Using the Provider with Terraform

Expand All @@ -36,7 +109,7 @@ terraform {
required_providers {
outscale = {
source = "outscale/outscale"
version = "0.12.0"
version = "1.0.0-rc.1"
}
}
}
Expand All @@ -56,7 +129,7 @@ terraform {
required_providers {
outscale = {
source = "outscale/outscale"
version = "0.12.0"
version = "1.0.0-rc.1"
}
}
}
Expand Down Expand Up @@ -89,7 +162,7 @@ terraform {
required_providers {
outscale = {
source = "outscale/outscale"
version = "0.12.0"
version = "1.0.0-rc.1"
}
}
}
Expand All @@ -113,23 +186,23 @@ Clone repository to: `$GOPATH/src/github.com/outscale/terraform-provider-outscal
```sh
mkdir -p $GOPATH/src/github.com/terraform-providers
cd $GOPATH/src/github.com/terraform-providers
git clone --branch v0.12.0 https://github.com/outscale/terraform-provider-outscale
git clone --branch v1.0.0-rc.1 https://github.com/outscale/terraform-provider-outscale
```
Enter the provider directory and build the provider
```sh
cd $GOPATH/src/github.com/terraform-providers/terraform-provider-outscale
go build -o terraform-provider-outscale_v0.12.0
go build -o terraform-provider-outscale_v1.0.0-rc.1
```
## Using the provider built
### For Terraform
#### On Linux

1. Download and install [Terraform](https://www.terraform.io/downloads.html)

2. Move the plugin to the repository ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/0.12.0/linux_amd64/.
2. Move the plugin to the repository ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/1.0.0-rc.1/linux_amd64/.
```shell
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/0.12.0/linux_amd64
mv terraform-provider-outscale_v0.12.0 ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/0.12.0/linux_amd64
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/1.0.0-rc.1/linux_amd64
mv terraform-provider-outscale_v1.0.0-rc.1 ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/1.0.0-rc.1/linux_amd64
```
3. Execute `terraform init`

Expand All @@ -138,10 +211,10 @@ mv terraform-provider-outscale_v0.12.0 ~/.terraform.d/plugins/registry.terraform
#### On macOS
1. Download and install [Terraform](https://www.terraform.io/downloads.html)

2. Move the plugin to the repository ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/0.12.0/darwin_arm64
2. Move the plugin to the repository ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/1.0.0-rc.1/darwin_arm64
```shell
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/0.12.0/darwin_arm64
mv terraform-provider-outscale_v0.12.0 ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/0.12.0/darwin_arm64
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/1.0.0-rc.1/darwin_arm64
mv terraform-provider-outscale_v1.0.0-rc.1 ~/.terraform.d/plugins/registry.terraform.io/outscale/outscale/1.0.0-rc.1/darwin_arm64
```

3. Execute `terraform init`
Expand All @@ -153,10 +226,10 @@ mv terraform-provider-outscale_v0.12.0 ~/.terraform.d/plugins/registry.terraform

1. Download and install [OpenTofu](https://opentofu.org/docs/intro/install/deb/)

2. Move the plugin to the repository ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/0.12.0/linux_amd64/.
2. Move the plugin to the repository ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/1.0.0-rc.1/linux_amd64/.
```shell
mkdir -p ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/0.12.0/linux_amd64
mv terraform-provider-outscale_v0.12.0 ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/0.12.0/linux_amd64
mkdir -p ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/1.0.0-rc.1/linux_amd64
mv terraform-provider-outscale_v1.0.0-rc.1 ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/1.0.0-rc.1/linux_amd64
```
3. Execute `tofu init`

Expand All @@ -165,10 +238,10 @@ mv terraform-provider-outscale_v0.12.0 ~/.terraform.d/plugins/registry.opentofu.
#### On macOS
1. Download and install [OpenTofu](https://opentofu.org/docs/intro/install/homebrew/)

2. Move the plugin to the repository ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/0.12.0/darwin_arm64
2. Move the plugin to the repository ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/1.0.0-rc.1/darwin_arm64
```shell
mkdir -p ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/0.12.0/darwin_arm64
mv terraform-provider-outscale_v0.12.0 ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/0.12.0/darwin_arm64
mkdir -p ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/1.0.0-rc.1/darwin_arm64
mv terraform-provider-outscale_v1.0.0-rc.1 ~/.terraform.d/plugins/registry.opentofu.org/outscale/outscale/1.0.0-rc.1/darwin_arm64
```

3. Execute `tofu init`
Expand Down

0 comments on commit ce8fce5

Please sign in to comment.