Skip to content

Commit 2e67bf0

Browse files
committed
Merge branch 'feat/support-route-waf-on-cache-tls' of github.com:yfodil/terraform-provider-scaleway into feat/support-route-waf-on-cache-tls
2 parents 46fde46 + 89ae228 commit 2e67bf0

25 files changed

+8734
-2398
lines changed

.github/workflows/announce.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
steps:
1111
- name: Get tag
1212
id: get_tag
13-
run: echo "{TAG}=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
13+
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
1414
- name: Get version
1515
id: get_version
16-
run: echo "{VERSION}=${TAG##v}" >> $GITHUB_OUTPUT
16+
run: echo "VERSION=${TAG##v}" >> $GITHUB_OUTPUT
1717
env:
1818
TAG: ${{ steps.get_tag.outputs.TAG }}
1919
- name: Prepare message
2020
id: get_message
21-
run: echo "{MSG}=${{ secrets.SLACK_MESSAGE }}" >> $GITHUB_OUTPUT
21+
run: echo "MSG=${{ secrets.SLACK_MESSAGE }}" >> $GITHUB_OUTPUT
2222
env:
2323
VERSION: ${{ steps.get_version.outputs.VERSION }}
2424
TAG: ${{ steps.get_tag.outputs.TAG }}

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ linters:
105105
- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
106106

107107
settings:
108+
govet:
109+
disable-all: true
110+
enable:
111+
- fieldalignment
108112
goconst:
109113
min-len: 5
110114
gosec:

docs/data-sources/instance_server.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ attached to the server.
6363

6464
- `enable_dynamic_ip` - True if dynamic IP in enable on the server.
6565

66-
- `routed_ip_enabled` - True if the server support routed ip only.
67-
6866
- `state` - The state of the server. Possible values are: `started`, `stopped` or `standby`.
6967

7068
- `cloud_init` - The cloud init script associated with this server.

docs/data-sources/instance_servers.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ In addition to all above arguments, the following attributes are exported:
6060
- `ipv6_address` - The default ipv6 address routed to the server. ( Only set when enable_ipv6 is set to true )
6161
- `ipv6_gateway` - The ipv6 gateway address. ( Only set when enable_ipv6 is set to true )
6262
- `ipv6_prefix_length` - The prefix length of the ipv6 subnet routed to the server. ( Only set when enable_ipv6 is set to true )
63-
- `routed_ip_enabled` - True if the server support routed ip only.
6463
- `enable_dynamic_ip` - If true a dynamic IP will be attached to the server.
6564
- `image` - The UUID or the label of the base image used by the server.
6665
- `placement_group_id` - The [placement group](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) the server is attached to.

docs/resources/baremetal_server.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,47 @@ resource "scaleway_baremetal_server" "base" {
226226
227227
```
228228

229+
### Migrate from hourly to monthly plan
230+
231+
To migrate from an hourly to a monthly subscription for a Scaleway Baremetal server, it is important to understand that the migration can only be done by using the data source.
232+
You cannot directly modify the subscription_period of an existing scaleway_baremetal_offer resource. Instead, you must define the monthly offer using the data source and then update the server configuration accordingly.
233+
234+
#### Hourly Plan Example
235+
236+
```terraform
237+
data "scaleway_baremetal_offer" "my_offer" {
238+
zone = "fr-par-1"
239+
name = "EM-B220E-NVME"
240+
subscription_period = "hourly"
241+
}
242+
243+
resource "scaleway_baremetal_server" "server01" {
244+
name = "UpdateSubscriptionPeriod"
245+
offer = data.scaleway_baremetal_offer.my_offer.offer_id
246+
zone = "%s"
247+
install_config_afterward = true
248+
}
249+
```
250+
251+
#### Monthly Plan Example
252+
253+
```terraform
254+
data "scaleway_baremetal_offer" "my_offer" {
255+
zone = "fr-par-1"
256+
name = "EM-B220E-NVME"
257+
subscription_period = "monthly"
258+
}
259+
260+
resource "scaleway_baremetal_server" "server01" {
261+
name = "UpdateSubscriptionPeriod"
262+
offer = data.scaleway_baremetal_offer.my_offer.offer_id
263+
zone = "fr-par-1"
264+
install_config_afterward = true
265+
}
266+
```
267+
268+
**Important** Once you migrate to a monthly subscription, you cannot downgrade back to an hourly plan. Ensure that the monthly plan meets your needs before making the switch.
269+
229270
## Argument Reference
230271

231272
The following arguments are supported:

docs/resources/instance_server.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ attached to the server. Updates to this field will trigger a stop/start of the s
227227

228228
~> **Important:** If this field contains local volumes, you have to first detach them, in one apply, and then delete the volume in another apply.
229229

230-
- `enable_ipv6` - (Defaults to `false`) Determines if IPv6 is enabled for the server. Useful only with `routed_ip_enabled` as false, otherwise ipv6 is always supported.
230+
- `enable_ipv6` - (Defaults to `false`) Determines if IPv6 is enabled for the server.
231231
Deprecated: Please use a scaleway_instance_ip with a `routed_ipv6` type.
232232

233233
- `ip_id` - (Optional) The ID of the reserved IP that is attached to the server.
@@ -238,10 +238,6 @@ attached to the server. Updates to this field will trigger a stop/start of the s
238238

239239
- `enable_dynamic_ip` - (Defaults to `false`) If true a dynamic IP will be attached to the server.
240240

241-
- `routed_ip_enabled` - (Defaults to `true`) If true, the server will support routed ips only. Changing it to true will migrate the server and its IP to routed type.
242-
243-
~> **Important:** Enabling routed ip will restart the server
244-
245241
- `state` - (Defaults to `started`) The state of the server. Possible values are: `started`, `stopped` or `standby`.
246242

247243
- `user_data` - (Optional) The user data associated with the server.
@@ -258,6 +254,8 @@ attached to the server. Updates to this field will trigger a stop/start of the s
258254

259255
- `replace_on_type_change` - (Defaults to false) If true, the server will be replaced if `type` is changed. Otherwise, the server will migrate.
260256

257+
- `protected` - (Optional) Set to true to activate server protection option.
258+
261259
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the server should be created.
262260

263261
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the server is associated with.

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module github.com/scaleway/terraform-provider-scaleway/v2
22

33
go 1.24.0
4+
45
require (
56
github.com/aws/aws-sdk-go-v2 v1.36.3
67
github.com/aws/aws-sdk-go-v2/config v1.29.9
@@ -25,7 +26,7 @@ require (
2526
github.com/nats-io/jwt/v2 v2.7.3
2627
github.com/nats-io/nats.go v1.38.0
2728
github.com/robfig/cron/v3 v3.0.1
28-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32.0.20250320132958-0f59cae533d0
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250407124844-38ab1ca8e81d
2930
github.com/stretchr/testify v1.10.0
3031
golang.org/x/crypto v0.36.0
3132
gopkg.in/dnaeon/go-vcr.v3 v3.2.0

go.sum

Lines changed: 2 additions & 2 deletions
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.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=
299+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250407124844-38ab1ca8e81d h1:EjD1RHPgsTomVw0lKgZu6YHK4ZMSBkSjeFrirnvWBcw=
300+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250407124844-38ab1ca8e81d/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=

internal/datasource/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ func notFound(err error) bool {
6060
}
6161

6262
type TooManyResultsError struct {
63-
Count int
6463
LastRequest interface{}
64+
Count int
6565
}
6666

6767
func (e *TooManyResultsError) Error() string {

internal/meta/meta.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ func (m Meta) ZoneSource() string {
7575

7676
type Config struct {
7777
ProviderSchema *schema.ResourceData
78+
HTTPClient *http.Client
7879
TerraformVersion string
7980
ForceZone scw.Zone
8081
ForceProjectID string
8182
ForceOrganizationID string
8283
ForceAccessKey string
8384
ForceSecretKey string
84-
HTTPClient *http.Client
8585
}
8686

8787
// NewMeta creates the Meta object containing the SDK client.
@@ -247,26 +247,26 @@ func loadProfile(ctx context.Context, d *schema.ResourceData) (*scw.Profile, *Cr
247247
// GetCredentialsSource infers the source of the credentials based on the priority order of the different profiles
248248
func GetCredentialsSource(defaultZoneProfile, activeProfile, providerProfile, envProfile *scw.Profile) *CredentialsSource {
249249
type SourceProfilePair struct {
250-
Source string
251250
Profile *scw.Profile
251+
Source string
252252
}
253253

254254
profilesInOrder := []SourceProfilePair{
255255
{
256-
CredentialsSourceDefault,
257-
defaultZoneProfile,
256+
Source: CredentialsSourceDefault,
257+
Profile: defaultZoneProfile,
258258
},
259259
{
260-
CredentialsSourceActiveProfile,
261-
activeProfile,
260+
Source: CredentialsSourceActiveProfile,
261+
Profile: activeProfile,
262262
},
263263
{
264-
CredentialsSourceProviderProfile,
265-
providerProfile,
264+
Source: CredentialsSourceProviderProfile,
265+
Profile: providerProfile,
266266
},
267267
{
268-
CredentialsSourceEnvironment,
269-
envProfile,
268+
Source: CredentialsSourceEnvironment,
269+
Profile: envProfile,
270270
},
271271
}
272272
credentialsSource := &CredentialsSource{}

0 commit comments

Comments
 (0)