Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/guides/dedicated_server_migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ terraform apply

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

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`.
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`.

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

Expand Down Expand Up @@ -74,7 +74,6 @@ resource "ovh_dedicated_server" "srv" {
ssh_key = "ssh-ed25519 AAAAC3..."
}
os = "debian12_64"
properties = null
storage = null
}
```
Expand Down
3 changes: 2 additions & 1 deletion docs/resources/dedicated_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ resource "ovh_dedicated_server" "server" {

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

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

Expand Down
14 changes: 6 additions & 8 deletions docs/resources/dedicated_server_reinstall_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,16 @@ resource "ovh_dedicated_server_reinstall_task" "server_install" {
service_name = data.ovh_dedicated_server.server.service_name
os = "byolinux_64"
customizations {
config_drive_metadata = {
foo = "bar"
hello = "world"
}
config_drive_user_data = "I2Nsb3VkLWNvbmZpZwpzc2hfYXV0aG9yaXplZF9rZXlzOgogIC0gc3NoLXJzYSBBQUFBQjhkallpdz09IG15c2VsZkBteWRvbWFpbi5uZXQKCnVzZXJzOgogIC0gbmFtZTogcGF0aWVudDAKICAgIHN1ZG86IEFMTD0oQUxMKSBOT1BBU1NXRDpBTEwKICAgIGdyb3VwczogdXNlcnMsIHN1ZG8KICAgIHNoZWxsOiAvYmluL2Jhc2gKICAgIGxvY2tfcGFzc3dkOiBmYWxzZQogICAgc3NoX2F1dGhvcml6ZWRfa2V5czoKICAgICAgLSBzc2gtcnNhIEFBQUFCOGRqWWl3PT0gbXlzZWxmQG15ZG9tYWluLm5ldApkaXNhYmxlX3Jvb3Q6IGZhbHNlCnBhY2thZ2VzOgogIC0gdmltCiAgLSB0cmVlCmZpbmFsX21lc3NhZ2U6IFRoZSBzeXN0ZW0gaXMgZmluYWxseSB1cCwgYWZ0ZXIgJFVQVElNRSBzZWNvbmRzCg=="
hostname = "mon-tux"
http_headers = {
Authorization = "Basic bG9naW46cGFzc3dvcmQ="
}
image_check_sum = "367f26c915f39314dde155db3a2b0326803e06975d1f4be04256f8b591e38fd4062d36eb7d50e99da7a50b7f4cd69640e56a4ab93e8e0274e4e478e0f84b5d29"
image_check_sum_type = "sha512"
image_url = "https://github.com/ashmonger/akution_test/releases/download/0.5-compress/deb11k6.qcow2"
}
properties = {
essential = "false"
role = "webservers"
image_url = "https://github.com/ashmonger/akution_test/releases/download/0.5-compress/deb11k6.qcow2"
}
}
```
Expand Down Expand Up @@ -241,7 +239,7 @@ The following arguments are supported:

~> **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).

* `properties` - Arbitrary properties to pass to cloud-init's config drive datasource. It supports any key with any string value.
* `properties` - Deprecated, has no effect

* `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).
* `disk_group_id`: Disk group id to install the OS to (default is 0, meaning automatic).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ resource "ovh_dedicated_server_reinstall_task" "server_install" {
service_name = data.ovh_dedicated_server.server.service_name
os = "byolinux_64"
customizations {
config_drive_metadata = {
foo = "bar"
hello = "world"
}
config_drive_user_data = "I2Nsb3VkLWNvbmZpZwpzc2hfYXV0aG9yaXplZF9rZXlzOgogIC0gc3NoLXJzYSBBQUFBQjhkallpdz09IG15c2VsZkBteWRvbWFpbi5uZXQKCnVzZXJzOgogIC0gbmFtZTogcGF0aWVudDAKICAgIHN1ZG86IEFMTD0oQUxMKSBOT1BBU1NXRDpBTEwKICAgIGdyb3VwczogdXNlcnMsIHN1ZG8KICAgIHNoZWxsOiAvYmluL2Jhc2gKICAgIGxvY2tfcGFzc3dkOiBmYWxzZQogICAgc3NoX2F1dGhvcml6ZWRfa2V5czoKICAgICAgLSBzc2gtcnNhIEFBQUFCOGRqWWl3PT0gbXlzZWxmQG15ZG9tYWluLm5ldApkaXNhYmxlX3Jvb3Q6IGZhbHNlCnBhY2thZ2VzOgogIC0gdmltCiAgLSB0cmVlCmZpbmFsX21lc3NhZ2U6IFRoZSBzeXN0ZW0gaXMgZmluYWxseSB1cCwgYWZ0ZXIgJFVQVElNRSBzZWNvbmRzCg=="
hostname = "mon-tux"
http_headers = {
Authorization = "Basic bG9naW46cGFzc3dvcmQ="
}
image_check_sum = "367f26c915f39314dde155db3a2b0326803e06975d1f4be04256f8b591e38fd4062d36eb7d50e99da7a50b7f4cd69640e56a4ab93e8e0274e4e478e0f84b5d29"
image_check_sum_type = "sha512"
image_url = "https://github.com/ashmonger/akution_test/releases/download/0.5-compress/deb11k6.qcow2"
}
properties = {
essential = "false"
role = "webservers"
}
}
75 changes: 75 additions & 0 deletions ovh/resource_dedicated_server_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion ovh/resource_dedicated_server_reinstall_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ func resourceDedicatedServerReinstallTask() *schema.Resource {
Description: "OS reinstallation customizations",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"config_drive_metadata": {
Type: schema.TypeMap,
Optional: true,
ForceNew: true,
Description: "Config Drive MetaData",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"config_drive_user_data": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -130,7 +139,7 @@ func resourceDedicatedServerReinstallTask() *schema.Resource {
Type: schema.TypeMap,
Optional: true,
ForceNew: true,
Description: "Arbitrary properties to pass to cloud-init's config drive datasource",
Description: "Attribute 'properties' is deprecated and has no effect",
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down
6 changes: 4 additions & 2 deletions ovh/resource_dedicated_server_reinstall_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,14 @@ resource "ovh_dedicated_server_reinstall_task" "server_reinstall" {
os = "byolinux_64"
customizations {
hostname = "mon-tux"
image_check_sum = "047122c9ff4d2a69512212104b06c678f5a9cdb22b75467353613ff87ccd03b57b38967e56d810e61366f9d22d6bd39ac0addf4e00a4c6445112a2416af8f225"
image_check_sum_type = "sha512"
image_url = "https://github.com/ashmonger/akution_test/releases/download/0.6-fixCache/deb11k6.qcow2"
efi_bootloader_path = "\\efi\\debian\\grubx64.efi"
ssh_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIrODOo0SvY5f0TlQNvGHIRKzr4bHPa+D5bYF18RiOgP [email protected]"
config_drive_user_data = "c3NoX2F1dGhvcml6ZWRfa2V5czoKICAtIHNzaC1yc2EgQUFBQUI4ZGpZaXc9PSBteXNlbGZAbXlkb21haW4ubmV0Cgp1c2VyczoKICAtIG5hbWU6IHBhdGllbnQwCiAgICBzdWRvOiBBTEw9KEFMTCkgTk9QQVNTV0Q6QUxMCiAgICBncm91cHM6IHVzZXJzLCBzdWRvCiAgICBzaGVsbDogL2Jpbi9iYXNoCiAgICBsb2NrX3Bhc3N3ZDogZmFsc2UKICAgIHNzaF9hdXRob3JpemVkX2tleXM6CiAgICAgIC0gc3NoLXJzYSBBQUFBQjhkallpdz09IG15c2VsZkBteWRvbWFpbi5uZXQKZGlzYWJsZV9yb290OiBmYWxzZQpwYWNrYWdlczoKICAtIHZpbQogIC0gdHJlZQpmaW5hbF9tZXNzYWdlOiBUaGUgc3lzdGVtIGlzIGZpbmFsbHkgdXAsIGFmdGVyICRVUFRJTUUgc2Vjb25kcw=="
config_drive_metadata = {
foo = "bar"
hello = "world"
}
http_headers = {
Authorization = "Basic bG9naW46cGFzc3dvcmQ="
}
Expand Down
2 changes: 2 additions & 0 deletions ovh/types_dedicated_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ type ExtrasDetails struct {
}

type DedicatedServerReinstallTaskCustomizations struct {
ConfigDriveMetadata map[string]interface{} `json:"configDriveMetadata,omitempty"`
ConfigDriveUserData *string `json:"configDriveUserData,omitempty"`
EfiBootloaderPath *string `json:"efiBootloaderPath,omitempty"`
Hostname *string `json:"hostname,omitempty"`
Expand All @@ -199,6 +200,7 @@ type DedicatedServerReinstallTaskCustomizations struct {
}

func (opts *DedicatedServerReinstallTaskCustomizations) FromResource(d *schema.ResourceData, parent string) *DedicatedServerReinstallTaskCustomizations {
opts.ConfigDriveMetadata = helpers.GetMapFromData(d, fmt.Sprintf("%s.config_drive_metadata", parent))
opts.ConfigDriveUserData = helpers.GetNilStringPointerFromData(d, fmt.Sprintf("%s.config_drive_user_data", parent))
opts.EfiBootloaderPath = helpers.GetNilStringPointerFromData(d, fmt.Sprintf("%s.efi_bootloader_path", parent))
opts.Hostname = helpers.GetNilStringPointerFromData(d, fmt.Sprintf("%s.hostname", parent))
Expand Down
3 changes: 1 addition & 2 deletions templates/guides/dedicated_server_migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ terraform apply

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

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`.
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`.

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

Expand Down Expand Up @@ -74,7 +74,6 @@ resource "ovh_dedicated_server" "srv" {
ssh_key = "ssh-ed25519 AAAAC3..."
}
os = "debian12_64"
properties = null
storage = null
}
```
Expand Down
3 changes: 2 additions & 1 deletion templates/resources/dedicated_server.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Use this resource to order and manage a dedicated server.

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

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

Expand Down
Loading