Skip to content

Commit 61316ee

Browse files
committed
add guide link and logs
1 parent 674516f commit 61316ee

File tree

10 files changed

+38
-17
lines changed

10 files changed

+38
-17
lines changed

docs/data-sources/vpc_public_gateway_dhcp.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp"
77

88
~> **Important:** The data source `scaleway_vpc_public_gateway_dhcp` has been deprecated and will no longer be supported.
99
In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed.
10+
For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md).
1011

1112
Gets information about a Public Gateway DHCP configuration.
1213

docs/data-sources/vpc_public_gateway_dhcp_reservation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp_reservation"
77

88
~> **Important:** The data source `scaleway_vpc_public_gateway_dhcp_reservation` has been deprecated and will no longer be supported.
99
In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed.
10-
You can use IPAM to manage your IPs.
10+
You can use IPAM to manage your IPs. For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md).
1111

1212
Gets information about a DHCP entry. For further information, please see the
1313
[API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#path-dhcp-entries-list-dhcp-entries).

docs/resources/vpc_gateway_network.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,17 @@ The following arguments are supported:
8989
- `ipam_config` - Auto-configure the GatewayNetwork using Scaleway's IPAM (IP address management service). Only one of `dhcp_id`, `static_address` and `ipam_config` should be specified.
9090
- `push_default_route` - Defines whether to enable the default route on the GatewayNetwork.
9191
- `ipam_ip_id` - Use this IPAM-booked IP ID as the Gateway's IP in this Private Network.
92-
- `enable_masquerade` - (Defaults to true) Whether masquerade (dynamic NAT) should be enabled on this GatewayNetwork
92+
- `enable_masquerade` - (Defaults to true) Whether masquerade (dynamic NAT) should be enabled on this GatewayNetwork.
93+
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the gateway network should be created.
94+
95+
~> **Important:**
96+
In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP fields are now deprecated.
97+
For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md).
98+
9399
- `dhcp_id` - (Deprecated) Please use `ipam_config`. The ID of the Public Gateway DHCP configuration. Only one of `dhcp_id`, `static_address` and `ipam_config` should be specified.
94100
- `enable_dhcp` - (Deprecated) Please use `ipam_config`. Whether a DHCP configuration should be enabled on this GatewayNetwork. Requires a DHCP ID.
95101
- `cleanup_dhcp` - (Deprecated) Please use `ipam_config`. Whether to remove DHCP configuration on this GatewayNetwork upon destroy. Requires DHCP ID.
96102
- `static_address` - (Deprecated) Please use `ipam_config`. Enable DHCP configration on this GatewayNetwork. Only one of `dhcp_id`, `static_address` and `ipam_config` should be specified.
97-
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the gateway network should be created.
98103

99104
## Attributes Reference
100105

docs/resources/vpc_public_gateway.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ The following arguments are supported:
5959
- `tags` - (Optional) The tags to associate with the Public Gateway.
6060
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the Public Gateway should be created.
6161
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the public gateway is associated with.
62-
- `upstream_dns_servers` - (Optional) Override the gateway's default recursive DNS servers, if DNS features are enabled.
62+
- `upstream_dns_servers` - (Deprecated) Override the gateway's default recursive DNS servers, if DNS features are enabled.
6363
- `ip_id` - (Optional) Attach an existing flexible IP to the gateway.
6464
- `bastion_enabled` - (Optional) Enable SSH bastion on the gateway.
6565
- `bastion_port` - (Optional) The port on which the SSH bastion will listen.
66+
- `allowed_ip_ranges` - (Optional) Set a definitive list of IP ranges (in CIDR notation) allowed to connect to the SSH bastion.
6667
- `enable_smtp` - (Optional) Enable SMTP on the gateway.
6768
- `refresh_ssh_keys` - (Optional) Trigger a refresh of the SSH keys on the Public Gateway by changing this field's value.
6869

docs/resources/vpc_public_gateway_dhcp.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp"
77

88
~> **Important:** The resource `scaleway_vpc_public_gateway_dhcp` has been deprecated and will no longer be supported.
99
In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed.
10+
For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md).
1011

1112
Creates and manages Scaleway VPC Public Gateway DHCP configurations.
1213
For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#dhcp-c05544).

docs/resources/vpc_public_gateway_dhcp_reservation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp_reservation"
77

88
~> **Important:** The resource `scaleway_vpc_public_gateway_dhcp_reservation` has been deprecated and will no longer be supported.
99
In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed.
10-
You can use IPAM to manage your IPs.
10+
You can use IPAM to manage your IPs. For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md).
1111

1212
Creates and manages [Scaleway DHCP Reservations](https://www.scaleway.com/en/docs/vpc/concepts/#dhcp).
1313

internal/services/vpcgw/dhcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func ResourceDHCP() *schema.Resource {
127127
Description: "The date and time of the last update of the public gateway.",
128128
},
129129
},
130-
DeprecationMessage: "The 'dhcp' resource is deprecated. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed.",
130+
DeprecationMessage: "The 'dhcp' resource is deprecated. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. For more information, please refer to the dedicated guide: https://github.com/scaleway/terraform-provider-scaleway/blob/master/docs/guides/migration_guide_vpcgw_v2.md",
131131
}
132132
}
133133

internal/services/vpcgw/dhcp_reservation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func ResourceDHCPReservation() *schema.Resource {
7575
"zone": zonal.Schema(),
7676
},
7777
CustomizeDiff: cdf.LocalityCheck("gateway_network_id"),
78-
DeprecationMessage: "The 'dhcp_reservation' resource is deprecated. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. You can use IPAM to manage your IPs",
78+
DeprecationMessage: "The 'dhcp_reservation' resource is deprecated. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. You can use IPAM to manage your IPs. For more information, please refer to the dedicated guide: https://github.com/scaleway/terraform-provider-scaleway/blob/master/docs/guides/migration_guide_vpcgw_v2.md",
7979
}
8080
}
8181

internal/services/vpcgw/network.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func ResourceNetwork() *schema.Resource {
6565

6666
return oldValue == newValue
6767
},
68-
Deprecated: "Please use ipam_config",
68+
Deprecated: "Please use ipam_config. For more information, please refer to the dedicated guide: https://github.com/scaleway/terraform-provider-scaleway/blob/master/docs/guides/migration_guide_vpcgw_v2.md",
6969
},
7070
"enable_masquerade": {
7171
Type: schema.TypeBool,
@@ -77,14 +77,14 @@ func ResourceNetwork() *schema.Resource {
7777
Type: schema.TypeBool,
7878
Optional: true,
7979
Description: "Enable DHCP config on this network",
80-
Deprecated: "Please use ipam_config",
80+
Deprecated: "Please use ipam_config. For more information, please refer to the dedicated guide: https://github.com/scaleway/terraform-provider-scaleway/blob/master/docs/guides/migration_guide_vpcgw_v2.md",
8181
},
8282
"cleanup_dhcp": {
8383
Type: schema.TypeBool,
8484
Optional: true,
8585
Computed: true,
8686
Description: "Remove DHCP config on this network on destroy",
87-
Deprecated: "Please use ipam_config",
87+
Deprecated: "Please use ipam_config. For more information, please refer to the dedicated guide: https://github.com/scaleway/terraform-provider-scaleway/blob/master/docs/guides/migration_guide_vpcgw_v2.md",
8888
},
8989
"static_address": {
9090
Type: schema.TypeString,
@@ -93,7 +93,7 @@ func ResourceNetwork() *schema.Resource {
9393
Computed: true,
9494
ValidateFunc: validation.IsCIDR,
9595
ConflictsWith: []string{"dhcp_id", "ipam_config"},
96-
Deprecated: "Please use ipam_config",
96+
Deprecated: "Please use ipam_config. For more information, please refer to the dedicated guide: https://github.com/scaleway/terraform-provider-scaleway/blob/master/docs/guides/migration_guide_vpcgw_v2.md",
9797
},
9898
"ipam_config": {
9999
Type: schema.TypeList,
@@ -211,6 +211,7 @@ func ResourceVPCGatewayNetworkRead(ctx context.Context, d *schema.ResourceData,
211211
if err != nil {
212212
if httperrors.Is412(err) {
213213
// Fallback to v1 API.
214+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for gateway network stabilization")
214215
gatewayV1, err := waitForVPCGatewayNetwork(ctx, apiV1, zone, ID, d.Timeout(schema.TimeoutRead))
215216
if err != nil {
216217
return diag.FromErr(err)
@@ -243,6 +244,7 @@ func ResourceVPCGatewayNetworkUpdate(ctx context.Context, d *schema.ResourceData
243244
_, err = waitForVPCGatewayNetworkV2(ctx, api, zone, id, d.Timeout(schema.TimeoutUpdate))
244245
if err != nil {
245246
if httperrors.Is412(err) {
247+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for gateway network stabilization")
246248
_, err = waitForVPCGatewayNetwork(ctx, apiV1, zone, id, d.Timeout(schema.TimeoutCreate))
247249
if err != nil {
248250
return diag.FromErr(err)
@@ -252,13 +254,14 @@ func ResourceVPCGatewayNetworkUpdate(ctx context.Context, d *schema.ResourceData
252254
return diag.FromErr(err)
253255
}
254256

255-
if err := updateGWNetwork(ctx, d, api, apiV1, zone, id); err != nil {
257+
if err = updateGWNetwork(ctx, d, api, apiV1, zone, id); err != nil {
256258
return diag.FromErr(err)
257259
}
258260

259261
_, err = waitForVPCGatewayNetworkV2(ctx, api, zone, id, d.Timeout(schema.TimeoutUpdate))
260262
if err != nil {
261263
if httperrors.Is412(err) {
264+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for gateway network stabilization")
262265
_, err = waitForVPCGatewayNetwork(ctx, apiV1, zone, id, d.Timeout(schema.TimeoutCreate))
263266
if err != nil {
264267
return diag.FromErr(err)
@@ -285,6 +288,7 @@ func ResourceVPCGatewayNetworkDelete(ctx context.Context, d *schema.ResourceData
285288
gwNetwork, err := waitForVPCGatewayNetworkV2(ctx, api, zone, id, d.Timeout(schema.TimeoutDelete))
286289
if err != nil {
287290
if httperrors.Is412(err) {
291+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for gateway network stabilization")
288292
_, err = waitForVPCGatewayNetwork(ctx, apiV1, zone, id, d.Timeout(schema.TimeoutCreate))
289293
if err != nil {
290294
return diag.FromErr(err)
@@ -311,6 +315,7 @@ func ResourceVPCGatewayNetworkDelete(ctx context.Context, d *schema.ResourceData
311315
case httperrors.Is404(err):
312316
return nil
313317
case httperrors.Is412(err):
318+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for gateway network stabilization")
314319
_, err = waitForVPCGatewayNetwork(ctx, apiV1, zone, id, d.Timeout(schema.TimeoutDelete))
315320
if err != nil && !httperrors.Is404(err) {
316321
return diag.FromErr(err)
@@ -326,6 +331,7 @@ func ResourceVPCGatewayNetworkDelete(ctx context.Context, d *schema.ResourceData
326331
case httperrors.Is404(err):
327332
return nil
328333
case httperrors.Is412(err):
334+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for public gateway stabilization")
329335
_, err = waitForVPCPublicGateway(ctx, apiV1, zone, id, d.Timeout(schema.TimeoutDelete))
330336
if err != nil && !httperrors.Is404(err) {
331337
return diag.FromErr(err)

internal/services/vpcgw/public_gateway.go

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

6+
"github.com/hashicorp/terraform-plugin-log/tflog"
67
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
78
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
89
v1 "github.com/scaleway/scaleway-sdk-go/api/vpcgw/v1"
@@ -200,6 +201,7 @@ func ResourceVPCPublicGatewayRead(ctx context.Context, d *schema.ResourceData, m
200201
if err != nil {
201202
if httperrors.Is412(err) {
202203
// Fallback to v1 API.
204+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for public gateway stabilization")
203205
gatewayV1, err := waitForVPCPublicGateway(ctx, apiV1, zone, id, d.Timeout(schema.TimeoutCreate))
204206
if err != nil {
205207
return diag.FromErr(err)
@@ -237,20 +239,23 @@ func ResourceVPCPublicGatewayUpdate(ctx context.Context, d *schema.ResourceData,
237239
if err != nil {
238240
return diag.FromErr(err)
239241
}
240-
}
241242

242-
_, err = waitForVPCPublicGatewayV2(ctx, api, zone, id, d.Timeout(schema.TimeoutCreate))
243-
if err != nil {
244-
return diag.FromErr(err)
243+
_, err = waitForVPCPublicGatewayV2(ctx, api, zone, id, d.Timeout(schema.TimeoutCreate))
244+
if err != nil {
245+
return diag.FromErr(err)
246+
}
247+
248+
tflog.Info(ctx, "Public Gateway successfully moved to IPAM mode")
245249
}
246250

247-
if err := updateGateway(ctx, d, api, apiV1, zone, id); err != nil {
251+
if err = updateGateway(ctx, d, api, apiV1, zone, id); err != nil {
248252
return diag.FromErr(err)
249253
}
250254

251255
_, err = waitForVPCPublicGatewayV2(ctx, api, zone, id, d.Timeout(schema.TimeoutCreate))
252256
if err != nil {
253257
if httperrors.Is412(err) {
258+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for public gateway stabilization")
254259
_, err = waitForVPCPublicGateway(ctx, apiV1, zone, id, d.Timeout(schema.TimeoutCreate))
255260
if err != nil {
256261
return diag.FromErr(err)
@@ -277,6 +282,7 @@ func ResourceVPCPublicGatewayDelete(ctx context.Context, d *schema.ResourceData,
277282
_, err = waitForVPCPublicGatewayV2(ctx, api, zone, id, d.Timeout(schema.TimeoutCreate))
278283
if err != nil {
279284
if httperrors.Is412(err) {
285+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for public gateway stabilization")
280286
_, err = waitForVPCPublicGateway(ctx, apiV1, zone, id, d.Timeout(schema.TimeoutCreate))
281287
if err != nil {
282288
return diag.FromErr(err)
@@ -301,6 +307,7 @@ func ResourceVPCPublicGatewayDelete(ctx context.Context, d *schema.ResourceData,
301307
case httperrors.Is404(err):
302308
return nil
303309
case httperrors.Is412(err):
310+
tflog.Warn(ctx, "v2 API returned 412, falling back to v1 API to wait for public gateway stabilization")
304311
_, err = waitForVPCPublicGateway(ctx, apiV1, zone, id, d.Timeout(schema.TimeoutDelete))
305312
if err != nil && !httperrors.Is404(err) {
306313
return diag.FromErr(err)

0 commit comments

Comments
 (0)