Skip to content

Commit 93bfa4e

Browse files
committed
remove useless details options
remove ovh_me_ssh_key from resource in test deprecate ovh_me_ssh_key(s) resource and data (endpoint will be EOL)
1 parent 83dd9a9 commit 93bfa4e

25 files changed

+150
-320
lines changed

ovh/data_me_installation_template.go

+6-31
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
2020

2121
// computed
2222
"default_language": {
23-
Type: schema.TypeString,
24-
Computed: true,
25-
Description: "The default language of this template",
23+
Type: schema.TypeString,
24+
Computed: true,
25+
Deprecated: "This field will be removed from the API, please use `userMetadata` instead.",
2626
},
2727
"customization": {
2828
Type: schema.TypeList,
@@ -44,15 +44,10 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
4444
Computed: true,
4545
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'",
4646
},
47-
"rating": {
48-
Type: schema.TypeInt,
49-
Deprecated: "field is not used anymore",
50-
Computed: true,
51-
},
5247
"ssh_key_name": {
53-
Type: schema.TypeString,
54-
Computed: true,
55-
Description: "Name of the ssh key that should be installed. Password login will be disabled",
48+
Type: schema.TypeString,
49+
Computed: true,
50+
Deprecated: "This field will be removed from the API, please use `userMetadata` instead.",
5651
},
5752
},
5853
},
@@ -160,11 +155,6 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
160155
Type: schema.TypeString,
161156
},
162157
},
163-
"beta": {
164-
Type: schema.TypeBool,
165-
Computed: true,
166-
Description: "This distribution is new and, although tested and functional, may still display odd behaviour",
167-
},
168158
"bit_format": {
169159
Type: schema.TypeInt,
170160
Computed: true,
@@ -175,11 +165,6 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
175165
Computed: true,
176166
Description: "Category of this template (informative only). (basic, customer, hosting, other, readyToUse, virtualisation)",
177167
},
178-
"deprecated": {
179-
Type: schema.TypeBool,
180-
Computed: true,
181-
Description: "is this distribution deprecated",
182-
},
183168
"description": {
184169
Type: schema.TypeString,
185170
Computed: true,
@@ -208,21 +193,11 @@ func dataSourceMeInstallationTemplate() *schema.Resource {
208193
Type: schema.TypeString,
209194
},
210195
},
211-
"last_modification": {
212-
Type: schema.TypeString,
213-
Computed: true,
214-
Description: "Date of last modification of the base image",
215-
},
216196
"lvm_ready": {
217197
Type: schema.TypeBool,
218198
Computed: true,
219199
Description: "This distribution supports Logical Volumes (Linux LVM)",
220200
},
221-
"supports_sql_server": {
222-
Type: schema.TypeBool,
223-
Computed: true,
224-
Description: "This distribution supports the microsoft SQL server",
225-
},
226201
},
227202
}
228203
}

ovh/data_me_installation_template_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ data "ovh_me_installation_template" "template" {
6161
`
6262
const testAccMeInstallationTemplateDatasourceConfig_Basic = `
6363
resource "ovh_me_installation_template" "template" {
64-
base_template_name = "centos7_64"
64+
base_template_name = "debian12_64"
6565
template_name = "%s"
66-
default_language = "en"
6766
}
6867
6968
data "ovh_me_installation_template" "template" {

ovh/data_me_installation_templates_test.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,15 @@ func TestAccMeInstallationTemplatesDataSource_basic(t *testing.T) {
5151

5252
const testAccMeInstallationTemplatesDatasourceConfig_presetup = `
5353
resource "ovh_me_installation_template" "template" {
54-
base_template_name = "centos7_64"
54+
base_template_name = "debian12_64"
5555
template_name = "%s"
56-
default_language = "en"
5756
}
5857
`
5958

6059
const testAccMeInstallationTemplatesDatasourceConfig_Basic = `
6160
resource "ovh_me_installation_template" "template" {
62-
base_template_name = "centos7_64"
61+
base_template_name = "debian12_64"
6362
template_name = "%s"
64-
default_language = "en"
6563
}
6664
6765
data "ovh_me_installation_templates" "templates" {}

ovh/data_me_ssh_key.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import (
88

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

3536
sshKey := &MeSshKeyResponse{}
36-
3737
keyName := d.Get("key_name").(string)
3838
err := config.OVHClient.Get(
3939
fmt.Sprintf("/me/sshKey/%s", keyName),

ovh/data_me_ssh_keys.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import (
1111

1212
func dataSourceMeSshKeys() *schema.Resource {
1313
return &schema.Resource{
14-
Read: dataSourceMeSshKeysRead,
14+
Read: dataSourceMeSshKeysRead,
15+
DeprecationMessage: "[DEPRECATED] SSH key names '/me/sshKey' will be deprecated soon",
1516
Schema: map[string]*schema.Schema{
1617
"names": {
1718
Type: schema.TypeSet,

ovh/import_me_installation_template_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ func TestAccMeInstallationTemplate_importBasic(t *testing.T) {
2121
{
2222
ResourceName: "ovh_me_installation_template.template",
2323
ImportState: true,
24-
ImportStateId: fmt.Sprintf("centos7_64/%s", installationTemplate),
24+
ImportStateId: fmt.Sprintf("debian12_64/%s", installationTemplate),
2525
ImportStateVerify: true,
2626
ImportStateVerifyIgnore: []string{
2727
"remove_default_partition_schemes",
28-
"customization.0.rating",
2928
},
3029
},
3130
},

ovh/import_me_ssh_key_test.go

-36
This file was deleted.

ovh/resource_dedicated_server_install_task.go

+10-22
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ func resourceDedicatedServerInstallTask() *schema.Resource {
6969
ForceNew: true,
7070
Description: "",
7171
},
72-
"install_sql_server": {
73-
Type: schema.TypeBool,
74-
Optional: true,
75-
ForceNew: true,
76-
Description: "",
77-
},
7872
"language": {
79-
Type: schema.TypeString,
80-
Optional: true,
81-
ForceNew: true,
82-
Description: "language",
73+
Type: schema.TypeString,
74+
Optional: true,
75+
ForceNew: true,
76+
Deprecated: "This field is deprecated and will be removed in a future release",
77+
},
78+
"use_spla": {
79+
Type: schema.TypeBool,
80+
Optional: true,
81+
ForceNew: true,
82+
Deprecated: "This field is deprecated and will be removed in a future release",
8383
},
8484
"no_raid": {
8585
Type: schema.TypeBool,
@@ -105,18 +105,6 @@ func resourceDedicatedServerInstallTask() *schema.Resource {
105105
ForceNew: true,
106106
Description: "",
107107
},
108-
"ssh_key_name": {
109-
Type: schema.TypeString,
110-
Optional: true,
111-
ForceNew: true,
112-
Description: "Name of the ssh key that should be installed. Password login will be disabled",
113-
},
114-
"use_spla": {
115-
Type: schema.TypeBool,
116-
Optional: true,
117-
ForceNew: true,
118-
Description: "",
119-
},
120108
},
121109
},
122110
},

ovh/resource_dedicated_server_install_task_test.go

+16-47
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,15 @@ func testAccDedicatedServerInstallConfig(config string) string {
120120
return fmt.Sprintf(
121121
testAccDedicatedServerInstallConfig_RebootOnDestroy,
122122
dedicated_server,
123-
testName,
124123
sshKey,
125-
testName,
126124
)
127125
}
128126

129127
if config == "usermetadata" {
130128
return fmt.Sprintf(
131129
testAccDedicatedServerInstallConfig_Usermetadata,
132130
dedicated_server,
133-
testName,
134131
sshKey,
135-
testName,
136132
sshKey,
137133
sshKey,
138134
)
@@ -143,7 +139,6 @@ func testAccDedicatedServerInstallConfig(config string) string {
143139
dedicated_server,
144140
testName,
145141
sshKey,
146-
testName,
147142
)
148143

149144
}
@@ -154,11 +149,6 @@ data ovh_dedicated_server_boots "harddisk" {
154149
boot_type = "harddisk"
155150
}
156151
157-
resource "ovh_me_ssh_key" "key" {
158-
key_name = "%s"
159-
key = "%s"
160-
}
161-
162152
resource ovh_dedicated_server_update "server" {
163153
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
164154
boot_id = data.ovh_dedicated_server_boots.harddisk.result[0]
@@ -167,13 +157,10 @@ resource ovh_dedicated_server_update "server" {
167157
}
168158
169159
resource "ovh_me_installation_template" "debian" {
170-
base_template_name = "debian10_64"
160+
base_template_name = "debian12_64"
171161
template_name = "%s"
172-
default_language = "en"
173-
174162
customization {
175-
custom_hostname = "mytest"
176-
ssh_key_name = ovh_me_ssh_key.key.key_name
163+
custom_hostname = "mytest"
177164
}
178165
}
179166
@@ -185,7 +172,10 @@ resource "time_sleep" "wait_for_ssh_key_sync" {
185172
resource ovh_dedicated_server_install_task "server_install" {
186173
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
187174
template_name = ovh_me_installation_template.debian.template_name
188-
175+
user_metadata {
176+
key = "sshKey"
177+
value ="%s"
178+
}
189179
depends_on = [time_sleep.wait_for_ssh_key_sync]
190180
}
191181
`
@@ -201,39 +191,26 @@ data ovh_dedicated_server_boots "rescue" {
201191
boot_type = "rescue"
202192
}
203193
204-
resource "ovh_me_ssh_key" "key" {
205-
key_name = "%s"
206-
key = "%s"
207-
}
208-
209194
resource ovh_dedicated_server_update "server" {
210195
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
211196
boot_id = data.ovh_dedicated_server_boots.harddisk.result[0]
212197
monitoring = true
213198
state = "ok"
214199
}
215200
216-
resource "ovh_me_installation_template" "debian" {
217-
base_template_name = "debian12_64"
218-
template_name = "%s"
219-
default_language = "en"
220-
221-
customization {
222-
custom_hostname = "mytest"
223-
ssh_key_name = ovh_me_ssh_key.key.key_name
224-
}
225-
}
226-
227201
resource "time_sleep" "wait_for_ssh_key_sync" {
228202
create_duration = "120s"
229203
depends_on = [ovh_me_installation_template.debian]
230204
}
231205
232206
resource ovh_dedicated_server_install_task "server_install" {
233207
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
234-
template_name = ovh_me_installation_template.debian.template_name
208+
template_name = "debian12_64"
235209
bootid_on_destroy = data.ovh_dedicated_server_boots.rescue.result[0]
236-
210+
user_metadata {
211+
key = "sshKey"
212+
value ="%s"
213+
}
237214
depends_on = [time_sleep.wait_for_ssh_key_sync]
238215
}
239216
`
@@ -243,27 +220,15 @@ data ovh_dedicated_server_boots "harddisk" {
243220
boot_type = "harddisk"
244221
}
245222
246-
247-
resource "ovh_me_ssh_key" "key" {
248-
key_name = "%s"
249-
key = "%s"
250-
}
251-
252223
resource ovh_dedicated_server_update "server" {
253224
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
254225
monitoring = true
255226
state = "ok"
256227
}
257228
258-
resource "ovh_me_installation_template" "byolinux" {
259-
base_template_name = "byolinux_64"
260-
template_name = "%s"
261-
default_language = "en"
262-
}
263-
264229
resource ovh_dedicated_server_install_task "server_install" {
265230
service_name = data.ovh_dedicated_server_boots.harddisk.service_name
266-
template_name = ovh_me_installation_template.byolinux.template_name
231+
template_name = "byolinux_64"
267232
user_metadata {
268233
key = "imageURL"
269234
value = "https://github.com/ashmonger/akution_test/releases/download/0.6-fixCache/deb11k6.qcow2"
@@ -292,5 +257,9 @@ resource ovh_dedicated_server_install_task "server_install" {
292257
key = "configDriveUserData"
293258
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"
294259
}
260+
user_metadata {
261+
key = "sshKey"
262+
value = "%s"
263+
}
295264
}
296265
`

0 commit comments

Comments
 (0)