Skip to content

Commit 25cf380

Browse files
authored
Merge branch 'master' into chore/bump__sdk__go
2 parents 4e8cbd4 + 573ed80 commit 25cf380

File tree

12 files changed

+29
-148
lines changed

12 files changed

+29
-148
lines changed

.github/workflows/acceptance-tests.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ jobs:
4747
# Checkout should always be before setup-go to ensure caching is working
4848
- name: Checkout
4949
uses: actions/checkout@v4
50+
- name: Install Terraform
51+
uses: hashicorp/setup-terraform@v3
5052
- name: Install Go
5153
uses: actions/setup-go@v5
5254
with:
53-
go-version: 1.22
55+
go-version: 1.23.5
5456
- name: Run Acceptance Tests
5557
run: go test -v ./internal/services/${{ matrix.products }} -timeout=2h
5658
env:
@@ -74,7 +76,9 @@ jobs:
7476
- name: Install Go
7577
uses: actions/setup-go@v5
7678
with:
77-
go-version: 1.22
79+
go-version: 1.23.5
80+
- name: Install Terraform
81+
uses: hashicorp/setup-terraform@v3
7882
- name: Run scwconfig tests
7983
run: go test -v ./internal/services/scwconfig -timeout=2m
8084
env:

.github/workflows/coverage.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ on:
1212
- docs/**
1313

1414
env:
15-
GO_VERSION: "1.22"
15+
GO_VERSION: "1.23.5"
1616
GO111MODULE: on
1717

1818
jobs:
1919
markdown-link-check:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4
23-
- uses: gaurav-nelson/[email protected].15
23+
- uses: gaurav-nelson/[email protected].16
2424
with:
2525
use-quiet-mode: 'yes'
2626
use-verbose-mode: 'yes'

.github/workflows/nightly.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Install Go
5252
uses: actions/setup-go@v5
5353
with:
54-
go-version: 1.22
54+
go-version: 1.23.5
5555
- name: Run Acceptance Tests
5656
run: go test -v ./internal/services/${{ matrix.products }} -timeout=4h
5757
env:
@@ -87,6 +87,7 @@ jobs:
8787
SLACK_WEBHOOK_NIGHTLY: ${{ secrets.SLACK_WEBHOOK_NIGHTLY }}
8888
FAILED_PRODUCT: ${{ matrix.products }}
8989
- name: Run acceptance test for cassettes
90+
if: success() || failure() # If the job is not cancelled, run it regardless of the result of the previous step
9091
run: go test -v github.com/scaleway/terraform-provider-scaleway/v2/internal/acctest -run TestAccCassettes_Validator
9192

9293
# sweeper needs to run after nightly completed
@@ -102,7 +103,9 @@ jobs:
102103
- name: Install Go
103104
uses: actions/setup-go@v5
104105
with:
105-
go-version: 1.22
106+
go-version: 1.23.5
107+
- name: Install Terraform
108+
uses: hashicorp/setup-terraform@v3
106109
- name: Run sweepers
107110
run: make sweep
108111
env:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Set up Go
2929
uses: actions/setup-go@v5
3030
with:
31-
go-version: 1.22
31+
go-version: 1.23.5
3232

3333
- name: Import GPG key
3434
id: import_gpg

.github/workflows/tfproviderlint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: actions/setup-go@v5
1515
with:
16-
go-version: 1.22
16+
go-version: 1.23.5
1717
- name: Install tfproviderlint
1818
run: go install github.com/bflad/tfproviderlint/cmd/tfproviderlint
1919
- name: Run tfproviderlint
@@ -25,7 +25,7 @@ jobs:
2525
- uses: actions/checkout@v4
2626
- uses: actions/setup-go@v5
2727
with:
28-
go-version: 1.22
28+
go-version: 1.23.5
2929
- uses: hashicorp/setup-terraform@v3
3030
- run: go install github.com/bflad/tfproviderdocs@latest
3131
- run: make tfproviderdocs

.github/workflows/unit-tests.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ on:
66

77
jobs:
88
tests:
9-
strategy:
10-
matrix:
11-
go-version: [1.22.x]
12-
platform: [ubuntu-latest]
13-
runs-on: ${{ matrix.platform }}
9+
runs-on: ubuntu-latest
1410
steps:
1511
# Checkout should always be before setup-go to ensure caching is working
1612
- name: Checkout
@@ -20,7 +16,9 @@ jobs:
2016
- name: Install Go
2117
uses: actions/setup-go@v5
2218
with:
23-
go-version: ${{ matrix.go-version }}
19+
go-version: 1.23.5
20+
- name: Install Terraform
21+
uses: hashicorp/setup-terraform@v3
2422
- name: Build binaries
2523
run: make build
2624
- name: Run unit tests

docs/resources/instance_ip.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ resource "scaleway_instance_ip" "server_ip" {}
1717

1818
The following arguments are supported:
1919

20-
- `type` - (Defaults to `nat`) The type of the IP (`nat`, `routed_ipv4`, `routed_ipv6`), more information in [the documentation](https://www.scaleway.com/en/docs/compute/instances/api-cli/using-routed-ips/)
21-
22-
~> **Important:** An IP can migrate from `nat` to `routed_ipv4` but cannot be converted back
23-
20+
- `type` - The type of the IP (`routed_ipv4`, `routed_ipv6`), more information in [the documentation](https://www.scaleway.com/en/docs/compute/instances/api-cli/using-routed-ips/)
2421
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the IP should be reserved.
2522
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the IP is associated with.
2623

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/scaleway/terraform-provider-scaleway/v2
22

3-
go 1.22.0
4-
5-
toolchain go1.23.1
3+
go 1.23.5
64

75
require (
86
github.com/aws/aws-sdk-go-v2 v1.32.7

internal/services/instance/ip.go

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package instance
33
import (
44
"context"
55

6-
"github.com/hashicorp/go-cty/cty"
76
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
87
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
98
instanceSDK "github.com/scaleway/scaleway-sdk-go/api/instance/v1"
@@ -12,6 +11,7 @@ import (
1211
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
1312
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/account"
1413
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
14+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1515
)
1616

1717
func ResourceIP() *schema.Resource {
@@ -39,22 +39,12 @@ func ResourceIP() *schema.Resource {
3939
Description: "The IP prefix",
4040
},
4141
"type": {
42-
Type: schema.TypeString,
43-
Computed: true,
44-
Optional: true,
45-
Description: "The type of instance IP",
46-
ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics {
47-
if i.(string) == "nat" {
48-
return diag.Diagnostics{{
49-
Severity: diag.Error,
50-
Summary: "NAT IPs are not supported anymore",
51-
Detail: "Remove explicit nat configuration, migrate to routed ips or downgrade terraform.\nLearn more about migration: https://www.scaleway.com/en/docs/compute/instances/how-to/migrate-routed-ips/",
52-
AttributePath: path,
53-
}}
54-
}
55-
56-
return nil
57-
},
42+
Type: schema.TypeString,
43+
Computed: true,
44+
Optional: true,
45+
ForceNew: true,
46+
Description: "The type of instance IP",
47+
ValidateDiagFunc: verify.ValidateEnum[instanceSDK.IPType](),
5848
},
5949
"reverse": {
6050
Type: schema.TypeString,
@@ -78,23 +68,6 @@ func ResourceIP() *schema.Resource {
7868
"organization_id": account.OrganizationIDSchema(),
7969
"project_id": account.ProjectIDSchema(),
8070
},
81-
CustomizeDiff: func(_ context.Context, diff *schema.ResourceDiff, _ interface{}) error {
82-
// The only allowed change is
83-
// nat -> routed_ipv4
84-
if diff.HasChange("type") {
85-
before, after := diff.GetChange("type")
86-
oldType := instanceSDK.IPType(before.(string))
87-
newType := instanceSDK.IPType(after.(string))
88-
89-
if oldType == "nat" && newType == "routed_ipv4" {
90-
return nil
91-
}
92-
93-
return diff.ForceNew("type")
94-
}
95-
96-
return nil
97-
},
9871
}
9972
}
10073

@@ -149,10 +122,6 @@ func ResourceInstanceIPUpdate(ctx context.Context, d *schema.ResourceData, m int
149122
req.Tags = types.ExpandUpdatedStringsPtr(d.Get("tags"))
150123
}
151124

152-
if d.HasChange("type") {
153-
req.Type = instanceSDK.IPType(d.Get("type").(string))
154-
}
155-
156125
_, err = instanceAPI.UpdateIP(req, scw.WithContext(ctx))
157126
if err != nil {
158127
return diag.FromErr(err)

0 commit comments

Comments
 (0)