Skip to content

Commit 182f006

Browse files
author
Arthur Amstutz
committed
feat: Add resource ovh_domain_name
1 parent 9da2c3d commit 182f006

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+6094
-599
lines changed

go.mod

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ require (
5353
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
5454
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
5555
github.com/zclconf/go-cty v1.15.0 // indirect
56-
golang.org/x/crypto v0.31.0 // indirect
56+
golang.org/x/crypto v0.33.0 // indirect
5757
golang.org/x/mod v0.19.0 // indirect
58-
golang.org/x/net v0.33.0 // indirect
58+
golang.org/x/net v0.35.0 // indirect
5959
golang.org/x/oauth2 v0.22.0 // indirect
60-
golang.org/x/sync v0.10.0 // indirect
61-
golang.org/x/sys v0.28.0 // indirect
62-
golang.org/x/text v0.21.0 // indirect
60+
golang.org/x/sync v0.11.0 // indirect
61+
golang.org/x/sys v0.30.0 // indirect
62+
golang.org/x/text v0.22.0 // indirect
6363
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
6464
google.golang.org/appengine v1.6.8 // indirect
6565
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect

go.sum

+11
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
172172
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
173173
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
174174
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
175+
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
176+
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
175177
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U=
176178
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
177179
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
@@ -183,13 +185,17 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
183185
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
184186
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
185187
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
188+
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
189+
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
186190
golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA=
187191
golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
188192
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
189193
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
190194
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
191195
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
192196
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
197+
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
198+
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
193199
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
194200
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
195201
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -204,17 +210,22 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
204210
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
205211
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
206212
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
213+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
214+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
207215
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
208216
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
209217
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
210218
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
219+
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
211220
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
212221
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
213222
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
214223
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
215224
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
216225
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
217226
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
227+
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
228+
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
218229
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
219230
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
220231
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=

ovh/order.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ func orderCreateFromResource(d *schema.ResourceData, meta interface{}, product s
244244

245245
func orderCreate(d *OrderModel, config *Config, product string, waitForCompletion bool) error {
246246
if d.OvhSubsidiary.ValueString() == "" {
247-
return fmt.Errorf("ovh_subsidiary is missing from configuration")
247+
subsidiary, err := getOVHSubsidiary(context.Background(), config.OVHClient)
248+
if err != nil {
249+
return fmt.Errorf("ovh_subsidiary is missing from configuration, and it couldn't be fetched automatically: %w", err)
250+
}
251+
d.OvhSubsidiary = types.NewTfStringValue(subsidiary)
248252
}
249253
if len(d.Plan.Elements()) == 0 {
250254
return fmt.Errorf("plan is missing from configuration")
@@ -696,3 +700,13 @@ func orderDetailOperations(c *ovh.Client, orderId int64, orderDetailId int64) ([
696700
}
697701
return operations, nil
698702
}
703+
704+
func getOVHSubsidiary(ctx context.Context, c *ovh.Client) (string, error) {
705+
var response MeResponse
706+
707+
if err := c.GetWithContext(ctx, "/me", &response); err != nil {
708+
return "", err
709+
}
710+
711+
return response.OvhSubsidiary, nil
712+
}

ovh/order_cart.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func orderCartGenericProductPlanRead(d *schema.ResourceData, meta interface{}) e
406406
)
407407

408408
if err := config.OVHClient.Get(endpoint, &res); err != nil {
409-
return fmt.Errorf("Error calling Get %s:\n\t %q", endpoint, err)
409+
return fmt.Errorf("error calling Get %s:\n\t %q", endpoint, err)
410410
}
411411

412412
match := false

ovh/order_resource_gen.go

+6-209
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ovh/provider_new.go

+1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ func (p *OvhProvider) Resources(_ context.Context) []func() resource.Resource {
226226
NewCloudProjectVolumeResource,
227227
NewDbaasLogsTokenResource,
228228
NewDedicatedServerResource,
229+
NewDomainNameResource,
229230
NewDomainZoneDnssecResource,
230231
NewDomainZoneImportResource,
231232
NewIpFirewallResource,

0 commit comments

Comments
 (0)