Skip to content

Commit 721e7b7

Browse files
authored
Merge pull request #1135 from ovh/fix/PUBM-43183-deprecated
feat(dedicated_server{,_reinstall_task}): mark properties as deprecated and add customizations.config_drive_metadata
2 parents 4e3cdeb + 59aaeba commit 721e7b7

11 files changed

+108
-24
lines changed

docs/guides/dedicated_server_migration.md

Lines changed: 1 addition & 2 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
```

docs/resources/dedicated_server.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ resource "ovh_dedicated_server" "server" {
109109

110110
* `os` - Operating System to install
111111
* `customizations` - Customization of the OS configuration
112+
* `config_drive_metadata` - Config Drive MetaData
112113
* `config_drive_user_data` - Config Drive UserData
113114
* `efi_bootloader_path` - Path of the EFI bootloader from the OS installed on the server
114115
* `hostname` - Custom hostname
@@ -139,7 +140,7 @@ resource "ovh_dedicated_server" "server" {
139140
* `raid_level` - Software raid type
140141
* `size` - Partition size in MiB
141142
* `scheme_name` - Partitioning scheme (if applicable with selected operating system)
142-
* `properties` - Arbitrary properties to pass to cloud-init's config drive datasource
143+
* `properties` - Deprecated, has no effect
143144

144145
### Arguments used to control the lifecycle of a dedicated server
145146

docs/resources/dedicated_server_reinstall_task.md

Lines changed: 6 additions & 8 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/download/0.5-compress/deb11k6.qcow2"
134132
}
135133
}
136134
```
@@ -241,7 +239,7 @@ 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.
242+
* `properties` - Deprecated, has no effect
245243

246244
* `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).
247245
* `disk_group_id`: Disk group id to install the OS to (default is 0, meaning automatic).

examples/resources/dedicated_server_reinstall_task/example_4.tf

Lines changed: 4 additions & 6 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"
2022
image_url = "https://github.com/ashmonger/akution_test/releases/download/0.5-compress/deb11k6.qcow2"
2123
}
22-
properties = {
23-
essential = "false"
24-
role = "webservers"
25-
}
2624
}

ovh/resource_dedicated_server_gen.go

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ovh/resource_dedicated_server_reinstall_task.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ func resourceDedicatedServerReinstallTask() *schema.Resource {
4848
Description: "OS reinstallation customizations",
4949
Elem: &schema.Resource{
5050
Schema: map[string]*schema.Schema{
51+
"config_drive_metadata": {
52+
Type: schema.TypeMap,
53+
Optional: true,
54+
ForceNew: true,
55+
Description: "Config Drive MetaData",
56+
Elem: &schema.Schema{
57+
Type: schema.TypeString,
58+
},
59+
},
5160
"config_drive_user_data": {
5261
Type: schema.TypeString,
5362
Optional: true,
@@ -130,7 +139,7 @@ func resourceDedicatedServerReinstallTask() *schema.Resource {
130139
Type: schema.TypeMap,
131140
Optional: true,
132141
ForceNew: true,
133-
Description: "Arbitrary properties to pass to cloud-init's config drive datasource",
142+
Description: "Attribute 'properties' is deprecated and has no effect",
134143
Elem: &schema.Schema{
135144
Type: schema.TypeString,
136145
},

ovh/resource_dedicated_server_reinstall_task_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,14 @@ resource "ovh_dedicated_server_reinstall_task" "server_reinstall" {
292292
os = "byolinux_64"
293293
customizations {
294294
hostname = "mon-tux"
295-
image_check_sum = "047122c9ff4d2a69512212104b06c678f5a9cdb22b75467353613ff87ccd03b57b38967e56d810e61366f9d22d6bd39ac0addf4e00a4c6445112a2416af8f225"
296-
image_check_sum_type = "sha512"
297295
image_url = "https://github.com/ashmonger/akution_test/releases/download/0.6-fixCache/deb11k6.qcow2"
298296
efi_bootloader_path = "\\efi\\debian\\grubx64.efi"
299297
ssh_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIrODOo0SvY5f0TlQNvGHIRKzr4bHPa+D5bYF18RiOgP [email protected]"
300298
config_drive_user_data = "c3NoX2F1dGhvcml6ZWRfa2V5czoKICAtIHNzaC1yc2EgQUFBQUI4ZGpZaXc9PSBteXNlbGZAbXlkb21haW4ubmV0Cgp1c2VyczoKICAtIG5hbWU6IHBhdGllbnQwCiAgICBzdWRvOiBBTEw9KEFMTCkgTk9QQVNTV0Q6QUxMCiAgICBncm91cHM6IHVzZXJzLCBzdWRvCiAgICBzaGVsbDogL2Jpbi9iYXNoCiAgICBsb2NrX3Bhc3N3ZDogZmFsc2UKICAgIHNzaF9hdXRob3JpemVkX2tleXM6CiAgICAgIC0gc3NoLXJzYSBBQUFBQjhkallpdz09IG15c2VsZkBteWRvbWFpbi5uZXQKZGlzYWJsZV9yb290OiBmYWxzZQpwYWNrYWdlczoKICAtIHZpbQogIC0gdHJlZQpmaW5hbF9tZXNzYWdlOiBUaGUgc3lzdGVtIGlzIGZpbmFsbHkgdXAsIGFmdGVyICRVUFRJTUUgc2Vjb25kcw=="
299+
config_drive_metadata = {
300+
foo = "bar"
301+
hello = "world"
302+
}
301303
http_headers = {
302304
Authorization = "Basic bG9naW46cGFzc3dvcmQ="
303305
}

ovh/types_dedicated_server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ type ExtrasDetails struct {
184184
}
185185

186186
type DedicatedServerReinstallTaskCustomizations struct {
187+
ConfigDriveMetadata map[string]interface{} `json:"configDriveMetadata,omitempty"`
187188
ConfigDriveUserData *string `json:"configDriveUserData,omitempty"`
188189
EfiBootloaderPath *string `json:"efiBootloaderPath,omitempty"`
189190
Hostname *string `json:"hostname,omitempty"`
@@ -199,6 +200,7 @@ type DedicatedServerReinstallTaskCustomizations struct {
199200
}
200201

201202
func (opts *DedicatedServerReinstallTaskCustomizations) FromResource(d *schema.ResourceData, parent string) *DedicatedServerReinstallTaskCustomizations {
203+
opts.ConfigDriveMetadata = helpers.GetMapFromData(d, fmt.Sprintf("%s.config_drive_metadata", parent))
202204
opts.ConfigDriveUserData = helpers.GetNilStringPointerFromData(d, fmt.Sprintf("%s.config_drive_user_data", parent))
203205
opts.EfiBootloaderPath = helpers.GetNilStringPointerFromData(d, fmt.Sprintf("%s.efi_bootloader_path", parent))
204206
opts.Hostname = helpers.GetNilStringPointerFromData(d, fmt.Sprintf("%s.hostname", parent))

templates/guides/dedicated_server_migration.md

Lines changed: 1 addition & 2 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
```

templates/resources/dedicated_server.md.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Use this resource to order and manage a dedicated server.
5656

5757
* `os` - Operating System to install
5858
* `customizations` - Customization of the OS configuration
59+
* `config_drive_metadata` - Config Drive MetaData
5960
* `config_drive_user_data` - Config Drive UserData
6061
* `efi_bootloader_path` - Path of the EFI bootloader from the OS installed on the server
6162
* `hostname` - Custom hostname
@@ -86,7 +87,7 @@ Use this resource to order and manage a dedicated server.
8687
* `raid_level` - Software raid type
8788
* `size` - Partition size in MiB
8889
* `scheme_name` - Partitioning scheme (if applicable with selected operating system)
89-
* `properties` - Arbitrary properties to pass to cloud-init's config drive datasource
90+
* `properties` - Attribute 'properties' is deprecated and has no effect
9091

9192
### Arguments used to control the lifecycle of a dedicated server
9293

0 commit comments

Comments
 (0)