Skip to content

Commit

Permalink
remove useless details options
Browse files Browse the repository at this point in the history
remove ovh_me_ssh_key from resource in test
deprecate ovh_me_ssh_key(s) resource and data (endpoint will be EOL)
  • Loading branch information
bigbigbang committed Apr 18, 2024
1 parent 83dd9a9 commit de5bd0e
Show file tree
Hide file tree
Showing 25 changed files with 151 additions and 317 deletions.
37 changes: 6 additions & 31 deletions ovh/data_me_installation_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func dataSourceMeInstallationTemplate() *schema.Resource {

// computed
"default_language": {
Type: schema.TypeString,
Computed: true,
Description: "The default language of this template",
Type: schema.TypeString,
Computed: true,
Deprecated: "This field will be removed from the API, please use `userMetadata` instead.",
},
"customization": {
Type: schema.TypeList,
Expand All @@ -44,15 +44,10 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
Computed: true,
Description: "indicate the string returned by your postinstall customisation script on successful execution. Advice: your script should return a unique validation string in case of succes. A good example is 'loh1Xee7eo OK OK OK UGh8Ang1Gu'",
},
"rating": {
Type: schema.TypeInt,
Deprecated: "field is not used anymore",
Computed: true,
},
"ssh_key_name": {
Type: schema.TypeString,
Computed: true,
Description: "Name of the ssh key that should be installed. Password login will be disabled",
Type: schema.TypeString,
Computed: true,
Deprecated: "This field will be removed from the API, please use `userMetadata` instead.",
},
},
},
Expand Down Expand Up @@ -160,11 +155,6 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
Type: schema.TypeString,
},
},
"beta": {
Type: schema.TypeBool,
Computed: true,
Description: "This distribution is new and, although tested and functional, may still display odd behaviour",
},
"bit_format": {
Type: schema.TypeInt,
Computed: true,
Expand All @@ -175,11 +165,6 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
Computed: true,
Description: "Category of this template (informative only). (basic, customer, hosting, other, readyToUse, virtualisation)",
},
"deprecated": {
Type: schema.TypeBool,
Computed: true,
Description: "is this distribution deprecated",
},
"description": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -208,21 +193,11 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
Type: schema.TypeString,
},
},
"last_modification": {
Type: schema.TypeString,
Computed: true,
Description: "Date of last modification of the base image",
},
"lvm_ready": {
Type: schema.TypeBool,
Computed: true,
Description: "This distribution supports Logical Volumes (Linux LVM)",
},
"supports_sql_server": {
Type: schema.TypeBool,
Computed: true,
Description: "This distribution supports the microsoft SQL server",
},
},
}
}
Expand Down
3 changes: 1 addition & 2 deletions ovh/data_me_installation_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ data "ovh_me_installation_template" "template" {
`
const testAccMeInstallationTemplateDatasourceConfig_Basic = `
resource "ovh_me_installation_template" "template" {
base_template_name = "centos7_64"
base_template_name = "debian12_64"
template_name = "%s"
default_language = "en"
}
data "ovh_me_installation_template" "template" {
Expand Down
6 changes: 2 additions & 4 deletions ovh/data_me_installation_templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,15 @@ func TestAccMeInstallationTemplatesDataSource_basic(t *testing.T) {

const testAccMeInstallationTemplatesDatasourceConfig_presetup = `
resource "ovh_me_installation_template" "template" {
base_template_name = "centos7_64"
base_template_name = "debian12_64"
template_name = "%s"
default_language = "en"
}
`

const testAccMeInstallationTemplatesDatasourceConfig_Basic = `
resource "ovh_me_installation_template" "template" {
base_template_name = "centos7_64"
base_template_name = "debian12_64"
template_name = "%s"
default_language = "en"
}
data "ovh_me_installation_templates" "templates" {}
Expand Down
4 changes: 2 additions & 2 deletions ovh/data_me_ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (

func dataSourceMeSshKey() *schema.Resource {
return &schema.Resource{
Read: dataSourceMeSshKeyRead,
Read: dataSourceMeSshKeyRead,
DeprecationMessage: "[DEPRECATED] SSH key names '/me/sshKey' will be deprecated soon",
Schema: map[string]*schema.Schema{
"key_name": {
Type: schema.TypeString,
Expand All @@ -33,7 +34,6 @@ func dataSourceMeSshKeyRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)

sshKey := &MeSshKeyResponse{}

keyName := d.Get("key_name").(string)
err := config.OVHClient.Get(
fmt.Sprintf("/me/sshKey/%s", keyName),
Expand Down
3 changes: 2 additions & 1 deletion ovh/data_me_ssh_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (

func dataSourceMeSshKeys() *schema.Resource {
return &schema.Resource{
Read: dataSourceMeSshKeysRead,
Read: dataSourceMeSshKeysRead,
DeprecationMessage: "[DEPRECATED] SSH key names '/me/sshKey' will be deprecated soon",
Schema: map[string]*schema.Schema{
"names": {
Type: schema.TypeSet,
Expand Down
3 changes: 1 addition & 2 deletions ovh/import_me_installation_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ func TestAccMeInstallationTemplate_importBasic(t *testing.T) {
{
ResourceName: "ovh_me_installation_template.template",
ImportState: true,
ImportStateId: fmt.Sprintf("centos7_64/%s", installationTemplate),
ImportStateId: fmt.Sprintf("debian12_64/%s", installationTemplate),
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"remove_default_partition_schemes",
"customization.0.rating",
},
},
},
Expand Down
36 changes: 0 additions & 36 deletions ovh/import_me_ssh_key_test.go

This file was deleted.

32 changes: 10 additions & 22 deletions ovh/resource_dedicated_server_install_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ func resourceDedicatedServerInstallTask() *schema.Resource {
ForceNew: true,
Description: "",
},
"install_sql_server": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Description: "",
},
"language": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "language",
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Deprecated: "This field is deprecated and will be removed in a future release",
},
"use_spla": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Deprecated: "This field is deprecated and will be removed in a future release",
},
"no_raid": {
Type: schema.TypeBool,
Expand All @@ -105,18 +105,6 @@ func resourceDedicatedServerInstallTask() *schema.Resource {
ForceNew: true,
Description: "",
},
"ssh_key_name": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Name of the ssh key that should be installed. Password login will be disabled",
},
"use_spla": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Description: "",
},
},
},
},
Expand Down
63 changes: 16 additions & 47 deletions ovh/resource_dedicated_server_install_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,15 @@ func testAccDedicatedServerInstallConfig(config string) string {
return fmt.Sprintf(
testAccDedicatedServerInstallConfig_RebootOnDestroy,
dedicated_server,
testName,
sshKey,
testName,
)
}

if config == "usermetadata" {
return fmt.Sprintf(
testAccDedicatedServerInstallConfig_Usermetadata,
dedicated_server,
testName,
sshKey,
testName,
sshKey,
sshKey,
)
Expand All @@ -143,7 +139,6 @@ func testAccDedicatedServerInstallConfig(config string) string {
dedicated_server,
testName,
sshKey,
testName,
)

}
Expand All @@ -154,11 +149,6 @@ data ovh_dedicated_server_boots "harddisk" {
boot_type = "harddisk"
}
resource "ovh_me_ssh_key" "key" {
key_name = "%s"
key = "%s"
}
resource ovh_dedicated_server_update "server" {
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
boot_id = data.ovh_dedicated_server_boots.harddisk.result[0]
Expand All @@ -167,13 +157,10 @@ resource ovh_dedicated_server_update "server" {
}
resource "ovh_me_installation_template" "debian" {
base_template_name = "debian10_64"
base_template_name = "debian12_64"
template_name = "%s"
default_language = "en"
customization {
custom_hostname = "mytest"
ssh_key_name = ovh_me_ssh_key.key.key_name
custom_hostname = "mytest"
}
}
Expand All @@ -185,7 +172,10 @@ resource "time_sleep" "wait_for_ssh_key_sync" {
resource ovh_dedicated_server_install_task "server_install" {
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
template_name = ovh_me_installation_template.debian.template_name
user_metadata {
key = "sshKey"
value ="%s"
}
depends_on = [time_sleep.wait_for_ssh_key_sync]
}
`
Expand All @@ -201,39 +191,26 @@ data ovh_dedicated_server_boots "rescue" {
boot_type = "rescue"
}
resource "ovh_me_ssh_key" "key" {
key_name = "%s"
key = "%s"
}
resource ovh_dedicated_server_update "server" {
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
boot_id = data.ovh_dedicated_server_boots.harddisk.result[0]
monitoring = true
state = "ok"
}
resource "ovh_me_installation_template" "debian" {
base_template_name = "debian12_64"
template_name = "%s"
default_language = "en"
customization {
custom_hostname = "mytest"
ssh_key_name = ovh_me_ssh_key.key.key_name
}
}
resource "time_sleep" "wait_for_ssh_key_sync" {
create_duration = "120s"
depends_on = [ovh_me_installation_template.debian]
}
resource ovh_dedicated_server_install_task "server_install" {
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
template_name = ovh_me_installation_template.debian.template_name
template_name = "debian12_64"
bootid_on_destroy = data.ovh_dedicated_server_boots.rescue.result[0]
user_metadata {
key = "sshKey"
value ="%s"
}
depends_on = [time_sleep.wait_for_ssh_key_sync]
}
`
Expand All @@ -243,27 +220,15 @@ data ovh_dedicated_server_boots "harddisk" {
boot_type = "harddisk"
}
resource "ovh_me_ssh_key" "key" {
key_name = "%s"
key = "%s"
}
resource ovh_dedicated_server_update "server" {
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
monitoring = true
state = "ok"
}
resource "ovh_me_installation_template" "byolinux" {
base_template_name = "byolinux_64"
template_name = "%s"
default_language = "en"
}
resource ovh_dedicated_server_install_task "server_install" {
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
template_name = ovh_me_installation_template.byolinux.template_name
template_name = "byolinux_64"
user_metadata {
key = "imageURL"
value = "https://github.com/ashmonger/akution_test/releases/download/0.6-fixCache/deb11k6.qcow2"
Expand Down Expand Up @@ -292,5 +257,9 @@ resource ovh_dedicated_server_install_task "server_install" {
key = "configDriveUserData"
value = "#cloud-config\nssh_authorized_keys:\n - %s\n\nusers:\n - name: aautret\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, sudo\n shell: /bin/bash\n lock_passwd: false\n ssh_authorized_keys:\n - %s\ndisable_root: false\npackages:\n - vim\n - tree\nfinal_message: The system is finally up, after $UPTIME seconds\n"
}
user_metadata {
key = "sshKey"
value = "%s"
}
}
`
Loading

0 comments on commit de5bd0e

Please sign in to comment.