Skip to content

Commit cfcdbd6

Browse files
authored
Merge branch 'master' into feat/add_support_for_blockedlist
2 parents 88dc563 + eaa7027 commit cfcdbd6

38 files changed

+11476
-4108
lines changed

docs/data-sources/lb_backends.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ In addition to all arguments above, the following attributes are exported:
5858
- `health_check_max_retries` - Number of allowed failed health check requests before the backend server is marked as down.
5959
- `health_check_tcp` - This block enables TCP health checks.
6060
- `health_check_http` - This block enables HTTP health checks.
61-
- `uri` - The HTTP endpoint URL to call for health check requests.
61+
- `uri` - The path of health check requests.
6262
- `method` - The HTTP method to use for health check requests.
6363
- `code` - The expected HTTP status code.
6464
- `host_header` - The HTTP host header to use for health check requests.
6565
- `health_check_https` - This block enables HTTPS health checks.
66-
- `uri` - The HTTPS endpoint URL to call for health check requests.
66+
- `uri` - The path of health check requests.
6767
- `method` - The HTTP method to use for health check requests.
6868
- `code` - The expected HTTP status code.
6969
- `host_header` - The HTTP host header to use for health check requests.

docs/data-sources/lb_routes.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ In addition to all arguments above, the following attributes are exported:
3838
- `backend_id` - The backend ID to redirect to
3939
- `created_at` - The date on which the route was created (RFC 3339 format).
4040
- `update_at` - The date on which the route was last updated (RFC 3339 format).
41+
- `match_subdomains` - If true, all subdomains will match.
4142
- `match_sni` - Server Name Indication TLS extension field from an incoming connection made via an SSL/TLS transport layer.
4243
- `match_host_header` - Specifies the host of the server to which the request is being sent.

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ $ export TF_APPEND_USER_AGENT="CI/CD System XYZ Job #1234"
270270

271271
In case you want to [debug a deployment](https://www.terraform.io/internals/debugging), you can use the following command to increase the level of verbosity.
272272

273-
`SCW_DEBUG=1 TF_LOG=WARN TF_LOG_PROVIDER=DEBUG terraform apply`
273+
`SCW_DEBUG=1 TF_LOG=DEBUG TF_LOG_PROVIDER=DEBUG terraform apply`
274274

275275
- `SCW_DEBUG`: set the debug level of the scaleway SDK.
276276
- `TF_LOG`: set the level of the Terraform logging.

docs/resources/apple_silicon_server.md

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ The following arguments are supported:
3636
associated with.
3737
- `enable_vpc` - (Optional, Default: false): Enables the VPC option when set to true.
3838

39+
- `commitment_type` (Optional, Default: duration_24h): Activate commitment for this server
40+
3941
## Attributes Reference
4042

4143
In addition to all arguments above, the following attributes are exported:

docs/resources/flexible_ip.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ page_title: "Scaleway: scaleway_flexible_ip"
88
Creates and manages Scaleway flexible IPs.
99
For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/elastic-metal-flexible-ip).
1010

11+
-> **Note:**
12+
Flexible IPs are exclusively available for Elastic Metal (bare metal) servers. They are not compatible with other Scaleway products.
13+
1114
## Example Usage
1215

1316
### Basic
@@ -74,6 +77,8 @@ The following arguments are supported:
7477
- `tags` - (Optional) A list of tags to apply to the flexible IP.
7578
- `reverse` - (Optional) The reverse domain associated with this flexible IP.
7679
- `is_ipv6` - (Optional) Defines whether the flexible IP has an IPv6 address.
80+
- `zone` -(Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) of the Flexible IP.
81+
7782

7883
## Attributes Reference
7984

@@ -88,7 +93,6 @@ In addition to all arguments above, the following attributes are exported:
8893
- `status` - The status of the flexible IP.
8994
- `created_at` - The date and time of the creation of the Flexible IP (Format ISO 8601).
9095
- `updated_at` - The date and time of the last update of the Flexible IP (Format ISO 8601).
91-
- `zone` - The zone of the Flexible IP.
9296
- `organization_id` - The organization of the Flexible IP.
9397
- `project_id` - The project of the Flexible IP.
9498

docs/resources/lb_backend.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ resource "scaleway_lb_backend" "backend01" {
3232
forward_port = "80"
3333
3434
health_check_http {
35-
uri = "www.test.com/health"
35+
uri = "/health"
3636
}
3737
}
3838
```
@@ -79,12 +79,12 @@ You may use one of the following health check types: `TCP`, `HTTP` or `HTTPS`. (
7979
- `health_check_max_retries` - (Default: `2`) Number of allowed failed health check requests before the backend server is marked as down.
8080
- `health_check_tcp` - (Optional) This block enables TCP health checks. Only one of `health_check_tcp`, `health_check_http` and `health_check_https` should be specified.
8181
- `health_check_http` - (Optional) This block enables HTTP health checks. Only one of `health_check_tcp`, `health_check_http` and `health_check_https` should be specified.
82-
- `uri` - (Required) The HTTP endpoint URL to call for health check requests.
82+
- `uri` - (Required) The path for health check requests.
8383
- `method` - (Default: `GET`) The HTTP method to use for health check requests.
8484
- `code` - (Default: `200`) The expected HTTP status code.
8585
- `host_header` - (Optional) The HTTP host header to use for health check requests.
8686
- `health_check_https` - (Optional) This block enable HTTPS health checks. Only one of `health_check_tcp`, `health_check_http` and `health_check_https` should be specified.
87-
- `uri` - (Required) The HTTPS endpoint URL to call for health check requests.
87+
- `uri` - (Required) The path for health check requests.
8888
- `method` - (Default: `GET`) The HTTP method to use for health check requests.
8989
- `code` - (Default: `200`) The expected HTTP status code.
9090
- `host_header` - (Optional) The HTTP host header to use for health check requests.

docs/resources/lb_frontend.md

+2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ The following arguments are supported:
171171

172172
- `enable_http3` - (Default: `false`) Activates HTTP/3 protocol.
173173

174+
- `connection_rate_limit` - (Optional) The rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
175+
174176
- `acl` - (Optional) A list of ACL rules to apply to the Load Balancer frontend. Defined below.
175177

176178
## acl

docs/resources/lb_route.md

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ The following arguments are supported:
7979

8080
- `backend_id` - (Required) The ID of the backend the route is associated with.
8181
- `frontend_id` - (Required) The ID of the frontend the route is associated with.
82+
- `match_subdomains` - (Default: `false`) If true, all subdomains will match.
8283
- `match_sni` - The Server Name Indication (SNI) value to match. Value to match in the Server Name Indication TLS extension (SNI) field from an incoming connection made via an SSL/TLS transport layer.
8384
Only one of `match_sni` and `match_host_header` should be specified.
8485

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ require (
2626
github.com/nats-io/jwt/v2 v2.7.3
2727
github.com/nats-io/nats.go v1.38.0
2828
github.com/robfig/cron/v3 v3.0.1
29-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32.0.20250306092204-9c7eed199df5
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32.0.20250320132958-0f59cae533d0
3030
github.com/stretchr/testify v1.10.0
31-
golang.org/x/crypto v0.33.0
31+
golang.org/x/crypto v0.35.0
3232
gopkg.in/dnaeon/go-vcr.v3 v3.2.0
3333
)
3434

@@ -132,7 +132,7 @@ require (
132132
go.opentelemetry.io/otel/trace v1.31.0 // indirect
133133
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
134134
golang.org/x/mod v0.23.0 // indirect
135-
golang.org/x/net v0.35.0 // indirect
135+
golang.org/x/net v0.36.0 // indirect
136136
golang.org/x/sync v0.11.0 // indirect
137137
golang.org/x/sys v0.30.0 // indirect
138138
golang.org/x/text v0.22.0 // indirect

go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
296296
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
297297
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
298298
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
299-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32.0.20250306092204-9c7eed199df5 h1:SxQid3QYa7GBdbdKqzTfnLRsaFJjSKPueH3duzuC1Dk=
300-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32.0.20250306092204-9c7eed199df5/go.mod h1:792k1RTU+5JeMXm35/e2Wgp71qPH/DmDoZrRc+EFZDk=
299+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32.0.20250320132958-0f59cae533d0 h1:aqpUaCWx5ta43b9dZv1bMIvUUJTux9Am+S7RmJbiVN8=
300+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32.0.20250320132958-0f59cae533d0/go.mod h1:792k1RTU+5JeMXm35/e2Wgp71qPH/DmDoZrRc+EFZDk=
301301
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
302302
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
303303
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
@@ -366,8 +366,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
366366
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
367367
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
368368
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
369-
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
370-
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
369+
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
370+
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
371371
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
372372
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
373373
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
@@ -385,8 +385,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
385385
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
386386
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
387387
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
388-
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
389-
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
388+
golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA=
389+
golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I=
390390
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
391391
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
392392
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

internal/services/applesilicon/server.go

+16-4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ func ResourceServer() *schema.Resource {
5050
Default: false,
5151
Description: "Whether or not to enable VPC access",
5252
},
53+
"commitment": {
54+
Type: schema.TypeString,
55+
Optional: true,
56+
Default: "duration_24h",
57+
Description: "The commitment period of the server",
58+
ValidateDiagFunc: verify.ValidateEnum[applesilicon.CommitmentType](),
59+
},
5360
"private_network": {
5461
Type: schema.TypeSet,
5562
Optional: true,
@@ -162,10 +169,11 @@ func ResourceAppleSiliconServerCreate(ctx context.Context, d *schema.ResourceDat
162169
}
163170

164171
createReq := &applesilicon.CreateServerRequest{
165-
Name: types.ExpandOrGenerateString(d.Get("name"), "m1"),
166-
Type: d.Get("type").(string),
167-
ProjectID: d.Get("project_id").(string),
168-
EnableVpc: d.Get("enable_vpc").(bool),
172+
Name: types.ExpandOrGenerateString(d.Get("name"), "m1"),
173+
Type: d.Get("type").(string),
174+
ProjectID: d.Get("project_id").(string),
175+
EnableVpc: d.Get("enable_vpc").(bool),
176+
CommitmentType: applesilicon.CommitmentType(d.Get("commitment").(string)),
169177
}
170178

171179
res, err := asAPI.CreateServer(createReq, scw.WithContext(ctx))
@@ -277,6 +285,10 @@ func ResourceAppleSiliconServerUpdate(ctx context.Context, d *schema.ResourceDat
277285
req.Name = types.ExpandStringPtr(d.Get("name"))
278286
}
279287

288+
if d.HasChange("commitment") {
289+
req.CommitmentType = &applesilicon.CommitmentTypeValue{CommitmentType: applesilicon.CommitmentType(d.Get("commitment").(string))}
290+
}
291+
280292
if d.HasChange("enable_vpc") {
281293
enableVpc := d.Get("enable_vpc").(bool)
282294
req.EnableVpc = &enableVpc

internal/services/applesilicon/server_test.go

+56
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func TestAccServer_EnableVPC(t *testing.T) {
128128
isServerPresent(tt, "scaleway_apple_silicon_server.main"),
129129
resource.TestCheckResourceAttr("scaleway_apple_silicon_server.main", "name", "TestAccServerEnableVPC"),
130130
resource.TestCheckResourceAttr("scaleway_apple_silicon_server.main", "type", "M2-M"),
131+
resource.TestCheckResourceAttr("scaleway_apple_silicon_server.main", "commitment", "duration_24h"),
131132
// Computed
132133
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "ip"),
133134
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "vnc_url"),
@@ -225,6 +226,61 @@ func TestAccServer_EnableVPC(t *testing.T) {
225226
})
226227
}
227228

229+
func TestAccServer_Commitment(t *testing.T) {
230+
t.Skip("can not delete server at the time")
231+
232+
tt := acctest.NewTestTools(t)
233+
defer tt.Cleanup()
234+
resource.ParallelTest(t, resource.TestCase{
235+
PreCheck: func() { acctest.PreCheck(t) },
236+
ProviderFactories: tt.ProviderFactories,
237+
CheckDestroy: isServerDestroyed(tt),
238+
Steps: []resource.TestStep{
239+
{
240+
Config: `
241+
242+
resource scaleway_apple_silicon_server main {
243+
name = "TestAccServerEnableDisableVPC"
244+
type = "M2-M"
245+
}
246+
`,
247+
Check: resource.ComposeTestCheckFunc(
248+
isServerPresent(tt, "scaleway_apple_silicon_server.main"),
249+
resource.TestCheckResourceAttr("scaleway_apple_silicon_server.main", "name", "TestAccServerEnableDisableVPC"),
250+
resource.TestCheckResourceAttr("scaleway_apple_silicon_server.main", "type", "M2-M"),
251+
resource.TestCheckResourceAttr("scaleway_apple_silicon_server.main", "commitment", "duration_24h"),
252+
// Computed
253+
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "ip"),
254+
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "vnc_url"),
255+
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "created_at"),
256+
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "deletable_at"),
257+
),
258+
},
259+
{
260+
Config: `
261+
262+
resource scaleway_apple_silicon_server main {
263+
name = "TestAccServerEnableDisableVPC"
264+
type = "M2-M"
265+
commitment = "renewed_monthly"
266+
}
267+
`,
268+
Check: resource.ComposeTestCheckFunc(
269+
isServerPresent(tt, "scaleway_apple_silicon_server.main"),
270+
resource.TestCheckResourceAttr("scaleway_apple_silicon_server.main", "name", "TestAccServerEnableDisableVPC"),
271+
resource.TestCheckResourceAttr("scaleway_apple_silicon_server.main", "type", "M2-M"),
272+
resource.TestCheckResourceAttr("scaleway_apple_silicon_server.main", "commitment", "renewed_monthly"),
273+
// Computed
274+
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "ip"),
275+
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "vnc_url"),
276+
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "created_at"),
277+
resource.TestCheckResourceAttrSet("scaleway_apple_silicon_server.main", "deletable_at"),
278+
),
279+
},
280+
},
281+
})
282+
}
283+
228284
func isServerPresent(tt *acctest.TestTools, n string) resource.TestCheckFunc {
229285
return func(s *terraform.State) error {
230286
rs, ok := s.RootModule().Resources[n]

internal/services/container/helpers_container.go

+25
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package container
33
import (
44
"context"
55
"errors"
6+
"fmt"
67
"strings"
78
"time"
89

@@ -302,6 +303,30 @@ func expandContainerSecrets(secretsRawMap interface{}) []*container.Secret {
302303
return secrets
303304
}
304305

306+
func convertToMapStringInterface(raw interface{}) map[string]interface{} {
307+
out := make(map[string]interface{})
308+
if raw == nil {
309+
return out
310+
}
311+
312+
m, ok := raw.(map[interface{}]interface{})
313+
if ok {
314+
for k, v := range m {
315+
stringKey := fmt.Sprintf("%v", k)
316+
out[stringKey] = v
317+
}
318+
319+
return out
320+
}
321+
322+
m2, ok := raw.(map[string]interface{})
323+
if ok {
324+
return m2
325+
}
326+
327+
return out
328+
}
329+
305330
func isContainerDNSResolveError(err error) bool {
306331
responseError := &scw.ResponseError{}
307332

internal/services/container/namespace.go

+22-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,28 @@ func ResourceContainerNamespaceUpdate(ctx context.Context, d *schema.ResourceDat
193193
}
194194

195195
if d.HasChange("secret_environment_variables") {
196-
req.SecretEnvironmentVariables = expandContainerSecrets(d.Get("secret_environment_variables"))
196+
oldSecretsRaw, newSecretsRaw := d.GetChange("secret_environment_variables")
197+
198+
oldSecretsMap := convertToMapStringInterface(oldSecretsRaw)
199+
newSecretsMap := convertToMapStringInterface(newSecretsRaw)
200+
201+
oldSecrets := expandContainerSecrets(oldSecretsMap)
202+
newSecrets := expandContainerSecrets(newSecretsMap)
203+
204+
deletedSecrets := make([]*container.Secret, 0)
205+
206+
for _, oldSecret := range oldSecrets {
207+
if _, exists := newSecretsMap[oldSecret.Key]; !exists {
208+
deletedSecrets = append(deletedSecrets, &container.Secret{
209+
Key: oldSecret.Key,
210+
Value: nil,
211+
})
212+
}
213+
}
214+
215+
deletedSecrets = append(deletedSecrets, newSecrets...)
216+
217+
req.SecretEnvironmentVariables = deletedSecrets
197218
}
198219

199220
if _, err := api.UpdateNamespace(req, scw.WithContext(ctx)); err != nil {

0 commit comments

Comments
 (0)