You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
page_title: "Migrating dedicated servers from previous versions to v2.2.0"
3
+
---
4
+
5
+
Version v2.0.0 of OVHcloud Terraform provider introduced a breaking change on the resources related to dedicated servers, mainly:
6
+
- Deletion of resource `ovh_dedicated_server_install_task` that has been replaced by a new resource `ovh_dedicated_server_reinstall_task`
7
+
- The parameters of resource `ovh_dedicated_server` have been updated to reflect the changes on parameters needed to reinstall a dedicated server
8
+
9
+
The complete changelog can be found [here](https://github.com/ovh/terraform-provider-ovh/releases/tag/v2.0.0).
10
+
11
+
This guide explains how to migrate your existing configuration relying on resource `ovh_dedicated_server_install_task` to a new configuration compatible with version v2.2.0 of the provider without triggering a reinstallation of your dedicated servers.
12
+
13
+
!> This documentation presents a direct migration path between v1.6.0 and v2.2.0. To make this transition easier, we released a version v1.8.0 of the provider that includes both deprecated resources and the new ones. The migration steps are the same, but this version allows a more gradual shift towards v2.2.0.
14
+
15
+
## First step: import your dedicated servers in the state
16
+
17
+
From version v2.0.0 and later, the preferred way to manage dedicated servers installation details is through usage of resource `ovh_dedicated_server`. As a result, if you don't already have your dedicated servers declared in your Terraform configuration, you must import them.
18
+
19
+
You can use an `import` block like the following:
20
+
21
+
```terraform
22
+
import {
23
+
id = "nsxxxxxxx.ip-xx-xx-xx.eu"
24
+
to = ovh_dedicated_server.srv
25
+
}
26
+
27
+
resource "ovh_dedicated_server" "srv" {}
28
+
```
29
+
30
+
-> If you are doing a first migration to v1.8.0, you should add the following parameter `prevent_install_on_import = true` to the dedicated server resource. This guarantees you that the server won't be reinstalled after import, even if you have a diff on the reinstall-related parameters.
31
+
32
+
To finish importing the resource into your Terraform state, you should run:
33
+
34
+
```sh
35
+
terraform apply
36
+
```
37
+
38
+
## Second step: backport your previous task details into the imported resource
39
+
40
+
This step is manual and requires you to convert the previous installation details from resource `ovh_dedicated_server_install_task` to the new fields of resource `ovh_dedicated_server`: `os`, `customizations`, `properties` and `storage`.
41
+
42
+
Let's take an example: if you previously used the following configuration:
You can check the documentation of resource `ovh_dedicated_server` to see what inputs are available for the reinstallation-related fields.
83
+
The documentation of resource `ovh_dedicated_server_reinstall_task` also includes several examples of configuration.
84
+
85
+
## Third step: make sure your server is not reinstalled unintentionally
86
+
87
+
You should add the following piece of configuration in the declaration of your dedicated server resource in order to avoid a reinstallation on the next `terraform apply`:
This is needed because there is no API endpoint that returns the previous installation parameters of a dedicated server. The goal here is to migrate your old configuration to the new format without triggering a reinstallation.
102
+
103
+
## Fourth step: remove the lifecycle block
104
+
105
+
After a while, whenever you need to trigger a reinstallation of your dedicated server, you can just remove the `lifecycle` field from your configuration and run `terraform apply`.
*`configuration` - Representation of a configuration item to personalize product
91
91
*`label` - (Required) Identifier of the resource
92
92
*`value` - (Required) Path to the resource in API.OVH.COM
93
+
*`service_name` - (Optional) The service_name of your dedicated server. This field can be used to avoid ordering a dedicated server at creation and just create the resource using an already existing service
*`disks` - Total number of disks in the disk group involved in the hardware raid configuration
125
-
*`raidLevel` - Hardware raid type
127
+
*`raid_level` - Hardware raid type
126
128
*`spares` - Number of disks in the disk group involved in the spare
127
129
*`partitioning` - Partitioning configuration
128
130
*`disks` - Total number of disks in the disk group involved in the partitioning configuration
129
131
*`layout` - Custom partitioning layout
130
132
*`extras` - Partition extras parameters
131
133
*`lv` - LVM-specific parameters
132
134
*`zp` - ZFS-specific parameters
133
-
*`fileSystem` - File system type
134
-
*`mountPoint` - Mount point
135
-
*`raidLevel` - Software raid type
135
+
*`file_system` - File system type
136
+
*`mount_point` - Mount point
137
+
*`raid_level` - Software raid type
136
138
*`size` - Partition size in MiB
137
-
*`schemeName` - Partitioning scheme (if applicable with selected operating system)
139
+
*`scheme_name` - Partitioning scheme (if applicable with selected operating system)
138
140
*`properties` - Arbitrary properties to pass to cloud-init's config drive datasource
139
141
142
+
### Arguments used to control the lifecycle of a dedicated server
143
+
144
+
*`keep_service_after_destroy` - Avoid termination of the service when deleting the resource (when using this parameter, make sure to apply your configuration before running the destroy so that the value is set in the state)
145
+
*`prevent_install_on_create` - Prevent server installation after it has been delivered
146
+
*`prevent_install_on_import` - Defines whether a reinstallation of the server is allowed after importing it if there is a modification on the installation parameters
147
+
140
148
## Attributes Reference
141
149
142
150
*`service_name` - The service_name of your dedicated server
Copy file name to clipboardExpand all lines: docs/resources/dedicated_server_reinstall_task.md
-8Lines changed: 0 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -282,11 +282,3 @@ The following attributes are exported:
282
282
*`function` - Function name (should be `hardInstall`).
283
283
*`start_date` - Task creation date in RFC3339 format.
284
284
*`status` - Task status (should be `done`)
285
-
286
-
## Import
287
-
288
-
Installation task can be imported using the `service_name` (`nsXXXX.ip...`) of the baremetal server, the `operating_system` used and ths `task_id`, separated by "/" E.g.,
0 commit comments