Skip to content

Commit 5f1ffe7

Browse files
committed
fix(dedicated_server{,_reinstall_task}): move properties to customizations.config_drive_metadata
ref: #PUBM-43183
1 parent 3b2f6a2 commit 5f1ffe7

12 files changed

+120
-80
lines changed

docs/guides/dedicated_server_migration.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ terraform apply
3737

3838
## Second step: backport your previous task details into the imported resource
3939

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`.
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` and `storage`.
4141

4242
Let's take an example: if you previously used the following configuration:
4343

@@ -74,7 +74,6 @@ resource "ovh_dedicated_server" "srv" {
7474
ssh_key = "ssh-ed25519 AAAAC3..."
7575
}
7676
os = "debian12_64"
77-
properties = null
7877
storage = null
7978
}
8079
```
@@ -93,7 +92,7 @@ resource "ovh_dedicated_server" "srv" {
9392
#
9493
9594
lifecycle {
96-
ignore_changes = [os, customizations, properties, storage]
95+
ignore_changes = [os, customizations, storage]
9796
}
9897
}
9998
```

docs/resources/dedicated_server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ resource "ovh_dedicated_server" "server" {
107107

108108
* `os` - Operating System to install
109109
* `customizations` - Customization of the OS configuration
110+
* `config_drive_metadata` - Config Drive MetaData
110111
* `config_drive_user_data` - Config Drive UserData
111112
* `efi_bootloader_path` - Path of the EFI bootloader from the OS installed on the server
112113
* `hostname` - Custom hostname
@@ -137,7 +138,6 @@ resource "ovh_dedicated_server" "server" {
137138
* `raid_level` - Software raid type
138139
* `size` - Partition size in MiB
139140
* `scheme_name` - Partitioning scheme (if applicable with selected operating system)
140-
* `properties` - Arbitrary properties to pass to cloud-init's config drive datasource
141141

142142
### Arguments used to control the lifecycle of a dedicated server
143143

docs/resources/dedicated_server_reinstall_task.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,16 @@ resource "ovh_dedicated_server_reinstall_task" "server_install" {
119119
service_name = data.ovh_dedicated_server.server.service_name
120120
os = "byolinux_64"
121121
customizations {
122+
config_drive_metadata = {
123+
foo = "bar"
124+
hello = "world"
125+
}
122126
config_drive_user_data = "I2Nsb3VkLWNvbmZpZwpzc2hfYXV0aG9yaXplZF9rZXlzOgogIC0gc3NoLXJzYSBBQUFBQjhkallpdz09IG15c2VsZkBteWRvbWFpbi5uZXQKCnVzZXJzOgogIC0gbmFtZTogcGF0aWVudDAKICAgIHN1ZG86IEFMTD0oQUxMKSBOT1BBU1NXRDpBTEwKICAgIGdyb3VwczogdXNlcnMsIHN1ZG8KICAgIHNoZWxsOiAvYmluL2Jhc2gKICAgIGxvY2tfcGFzc3dkOiBmYWxzZQogICAgc3NoX2F1dGhvcml6ZWRfa2V5czoKICAgICAgLSBzc2gtcnNhIEFBQUFCOGRqWWl3PT0gbXlzZWxmQG15ZG9tYWluLm5ldApkaXNhYmxlX3Jvb3Q6IGZhbHNlCnBhY2thZ2VzOgogIC0gdmltCiAgLSB0cmVlCmZpbmFsX21lc3NhZ2U6IFRoZSBzeXN0ZW0gaXMgZmluYWxseSB1cCwgYWZ0ZXIgJFVQVElNRSBzZWNvbmRzCg=="
123127
hostname = "mon-tux"
124128
http_headers = {
125129
Authorization = "Basic bG9naW46cGFzc3dvcmQ="
126130
}
127-
image_check_sum = "367f26c915f39314dde155db3a2b0326803e06975d1f4be04256f8b591e38fd4062d36eb7d50e99da7a50b7f4cd69640e56a4ab93e8e0274e4e478e0f84b5d29"
128-
image_check_sum_type = "sha512"
129-
image_url = "https://github.com/ashmonger/akution_test/releases/download/0.5-compress/deb11k6.qcow2"
130-
}
131-
properties = {
132-
essential = "false"
133-
role = "webservers"
131+
image_url = "https://github.com/ashmonger/akution_test/releases/latest/download/deb11k6.qcow2"
134132
}
135133
}
136134
```
@@ -241,8 +239,6 @@ The following arguments are supported:
241239

242240
~> **WARNING** Some customizations may be required on some Operating Systems. [Check how to list the available and required customization(s) for your operating system](https://help.ovhcloud.com/csm/en-dedicated-servers-api-os-installation?id=kb_article_view&sysparm_article=KB0061951#os-inputs) (do not forget to adapt camel case customization name to snake case parameter).
243241

244-
* `properties` - Arbitrary properties to pass to cloud-init's config drive datasource. It supports any key with any string value.
245-
246242
* `storage`: OS reinstallation storage configurations. [More details about disks, hardware/software RAID and partitioning configuration](https://help.ovhcloud.com/csm/en-dedicated-servers-api-partitioning?id=kb_article_view&sysparm_article=KB0043882) (do not forget to adapt camel case parameters to snake case parameters).
247243
* `disk_group_id`: Disk group id to install the OS to (default is 0, meaning automatic).
248244
* `hardware_raid`: Hardware Raid configurations (if not specified, all disks of the chosen disk group id will be configured in JBOD mode).

examples/resources/dedicated_server_reinstall_task/example_4.tf

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@ resource "ovh_dedicated_server_reinstall_task" "server_install" {
1010
service_name = data.ovh_dedicated_server.server.service_name
1111
os = "byolinux_64"
1212
customizations {
13+
config_drive_metadata = {
14+
foo = "bar"
15+
hello = "world"
16+
}
1317
config_drive_user_data = "I2Nsb3VkLWNvbmZpZwpzc2hfYXV0aG9yaXplZF9rZXlzOgogIC0gc3NoLXJzYSBBQUFBQjhkallpdz09IG15c2VsZkBteWRvbWFpbi5uZXQKCnVzZXJzOgogIC0gbmFtZTogcGF0aWVudDAKICAgIHN1ZG86IEFMTD0oQUxMKSBOT1BBU1NXRDpBTEwKICAgIGdyb3VwczogdXNlcnMsIHN1ZG8KICAgIHNoZWxsOiAvYmluL2Jhc2gKICAgIGxvY2tfcGFzc3dkOiBmYWxzZQogICAgc3NoX2F1dGhvcml6ZWRfa2V5czoKICAgICAgLSBzc2gtcnNhIEFBQUFCOGRqWWl3PT0gbXlzZWxmQG15ZG9tYWluLm5ldApkaXNhYmxlX3Jvb3Q6IGZhbHNlCnBhY2thZ2VzOgogIC0gdmltCiAgLSB0cmVlCmZpbmFsX21lc3NhZ2U6IFRoZSBzeXN0ZW0gaXMgZmluYWxseSB1cCwgYWZ0ZXIgJFVQVElNRSBzZWNvbmRzCg=="
1418
hostname = "mon-tux"
1519
http_headers = {
1620
Authorization = "Basic bG9naW46cGFzc3dvcmQ="
1721
}
18-
image_check_sum = "367f26c915f39314dde155db3a2b0326803e06975d1f4be04256f8b591e38fd4062d36eb7d50e99da7a50b7f4cd69640e56a4ab93e8e0274e4e478e0f84b5d29"
19-
image_check_sum_type = "sha512"
20-
image_url = "https://github.com/ashmonger/akution_test/releases/download/0.5-compress/deb11k6.qcow2"
21-
}
22-
properties = {
23-
essential = "false"
24-
role = "webservers"
22+
image_url = "https://github.com/ashmonger/akution_test/releases/latest/download/deb11k6.qcow2"
2523
}
2624
}

ovh/resource_dedicated_server.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,9 @@ func (r *dedicatedServerResource) Update(ctx context.Context, req resource.Updat
298298
responseData.MergeWith(&planData)
299299
responseData.MergeWith(&stateData)
300300

301-
// Explicitely set Customizations/Properties/Storage to what was defined in the plan
301+
// Explicitely set Customizations/Storage to what was defined in the plan
302302
// as we can't determine the right thing to do in MergeWith function
303303
responseData.Customizations = planData.Customizations
304-
responseData.Properties = planData.Properties
305304
responseData.Storage = planData.Storage
306305

307306
// Same thing for the flags to control reinstallation, set the plan value explicitly
@@ -460,8 +459,7 @@ func (r *dedicatedServerResource) reinstallDedicatedServer(ctx context.Context,
460459
if planData.Os.ValueString() != "" &&
461460
stateData.Os.ValueString() != planData.Os.ValueString() ||
462461
!stateData.Customizations.Equal(planData.Customizations) ||
463-
!stateData.Storage.Equal(planData.Storage) ||
464-
!stateData.Properties.Equal(planData.Properties) {
462+
!stateData.Storage.Equal(planData.Storage) {
465463
shouldReinstall = true
466464
}
467465
}

0 commit comments

Comments
 (0)