Skip to content

Commit c5a4a97

Browse files
authored
Merge branch 'master' into feat/add_support_for_blockedlist
2 parents 042f0e5 + b8dca3e commit c5a4a97

File tree

55 files changed

+14551
-23067
lines changed

Some content is hidden

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

55 files changed

+14551
-23067
lines changed

docs/data-sources/vpc_gateway_network.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ data scaleway_vpc_gateway_network by_gateway_and_pn {
3737
* `gateway_id` - (Optional) ID of the Public Gateway the GatewayNetwork is linked to
3838
* `private_network_id` - (Optional) ID of the Private Network the GatewayNetwork is linked to
3939
* `enable_masquerade` - (Optional) Whether masquerade (dynamic NAT) is enabled on requested GatewayNetwork
40-
* `dhcp_id` - (Optional) ID of the Public Gateway's DHCP configuration
40+
* `dhcp_id` - (Deprecated) ID of the Public Gateway's DHCP configuration
4141

4242
## Attributes Reference
4343

docs/data-sources/vpc_public_gateway_dhcp.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp"
55

66
# scaleway_vpc_public_gateway_dhcp
77

8+
~> **Important:** The data source `scaleway_vpc_public_gateway_dhcp` has been deprecated and will no longer be supported.
9+
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).
11+
812
Gets information about a Public Gateway DHCP configuration.
913

1014
## Example Usage

docs/data-sources/vpc_public_gateway_dhcp_reservation.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp_reservation"
55

66
# scaleway_vpc_public_gateway_dhcp_reservation
77

8+
~> **Important:** The data source `scaleway_vpc_public_gateway_dhcp_reservation` has been deprecated and will no longer be supported.
9+
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. For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md).
11+
812
Gets information about a DHCP entry. For further information, please see the
913
[API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#path-dhcp-entries-list-dhcp-entries).
1014

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
---
2+
page_title: "Moving a Public Gateway from Legacy mode to IPAM mode, for v2 compatibility"
3+
---
4+
5+
# Moving a Public Gateway from Legacy mode to IPAM mode
6+
7+
This guide explains how to move a Public Gateway from [Legacy mode](https://www.scaleway.com/en/docs/public-gateways/concepts/#ipam) to IPAM mode. Only gateways in IPAM mode will be compatible with the new v2 of the Public Gateways API. v1 of the API is deprecated, and will be removed before the end of 2025.
8+
In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network.
9+
In IPAM mode, these functionalities are managed by Scaleway IPAM.
10+
In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed on the Public Gateway itself.
11+
12+
You can find out more about the deprecation of v1 of the Public Gateways API, and the obligatory move to IPAM mode, in the [main Public Gateways documentation](https://www.scaleway.com/en/docs/public-gateways/).
13+
14+
Note:
15+
Trigger the move from Legacy mode to IPAM mode by setting the `move_to_ipam` flag on your Public Gateway resource.
16+
You can do this via the Terraform configuration or by using the Scaleway CLI/Console.
17+
18+
Using the CLI:
19+
Ensure you have at least version v2.38.0 of the Scaleway CLI installed. Then run:
20+
21+
```bash
22+
scw vpc-gw gateway move-to-ipam 'id-of-the-public-gateway'
23+
```
24+
25+
26+
## Prerequisites
27+
28+
### Ensure the Latest Provider Version
29+
30+
Ensure your Scaleway Terraform provider is updated to at least version `2.52.0`.
31+
32+
```hcl
33+
terraform {
34+
required_providers {
35+
scaleway = {
36+
source = "scaleway/scaleway"
37+
version = "~> v2.52.0"
38+
}
39+
}
40+
}
41+
```
42+
43+
## Steps to Move to IPAM Mode
44+
45+
### Legacy Configuration
46+
47+
A typical legacy configuration might look like this:
48+
49+
```hcl
50+
resource "scaleway_vpc" "main" {
51+
name = "foo"
52+
}
53+
54+
resource "scaleway_vpc_private_network" "main" {
55+
name = "bar"
56+
vpc_id = scaleway_vpc.main.id
57+
}
58+
59+
resource "scaleway_vpc_public_gateway_ip" "main" {
60+
}
61+
62+
resource "scaleway_vpc_public_gateway" "main" {
63+
name = "foobar"
64+
type = "VPC-GW-S"
65+
ip_id = scaleway_vpc_public_gateway_ip.main.id
66+
}
67+
68+
resource "scaleway_vpc_public_gateway_dhcp" "main" {
69+
subnet = "192.168.1.0/24"
70+
}
71+
72+
resource "scaleway_instance_server" "main" {
73+
image = "ubuntu_focal"
74+
type = "DEV1-S"
75+
}
76+
77+
resource "scaleway_instance_private_nic" "main" {
78+
server_id = scaleway_instance_server.main.id
79+
private_network_id = scaleway_vpc_private_network.main.id
80+
}
81+
82+
resource "scaleway_vpc_gateway_network" "main" {
83+
gateway_id = scaleway_vpc_public_gateway.main.id
84+
private_network_id = scaleway_vpc_private_network.main.id
85+
dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id
86+
cleanup_dhcp = true
87+
enable_masquerade = true
88+
}
89+
90+
resource "scaleway_vpc_public_gateway_dhcp_reservation" "main" {
91+
gateway_network_id = scaleway_vpc_gateway_network.main.id
92+
mac_address = scaleway_instance_private_nic.main.mac_address
93+
ip_address = "192.168.1.1"
94+
}
95+
```
96+
97+
### Triggering the move to IPAM-mode
98+
99+
Before updating your configuration, you must trigger the move to IPAM-mode on the Public Gateway resource. For example, add the `move_to_ipam` flag:
100+
101+
```hcl
102+
resource "scaleway_vpc_public_gateway" "main" {
103+
name = "foobar"
104+
type = "VPC-GW-S"
105+
ip_id = scaleway_vpc_public_gateway_ip.main.id
106+
move_to_ipam = true
107+
}
108+
```
109+
110+
This call puts the gateway into IPAM mode and means it will now be managed by v2 of the API instead of v1. The DHCP configuration and reservations remain intact, but the underlying resource is now managed using v2.
111+
112+
### Updated Configuration
113+
114+
After triggering the move, update your Terraform configuration as follows:
115+
116+
1. **Remove the DHCP and DHCP Reservation Resources**
117+
118+
Since DHCP functionality is built directly into Private Networks, you no longer need the DHCP configuration resources. Delete the following from your config:
119+
120+
`scaleway_vpc_public_gateway_dhcp`
121+
`scaleway_vpc_public_gateway_dhcp_reservation`
122+
123+
2. **Update the Gateway Network**
124+
125+
Replace the DHCP related attributes with an `ipam_config` block. For example
126+
127+
```hcl
128+
resource "scaleway_vpc_gateway_network" "main" {
129+
gateway_id = scaleway_vpc_public_gateway.main.id
130+
private_network_id = scaleway_vpc_private_network.main.id
131+
enable_masquerade = true
132+
ipam_config {
133+
push_default_route = false
134+
}
135+
}
136+
```
137+
138+
### Using the IPAM Datasource and Resource for Reservations
139+
140+
After putting your Public Gateway in IPAM mode, you no longer manage DHCP reservations with dedicated resources.
141+
Instead, you remove the legacy DHCP reservation resource and switch to using IPAM to manage your IPs.
142+
143+
1. **Retrieve an Existing IP with the IPAM Datasource**
144+
If you have already reserved an IP (for example, via your legacy configuration), even after deleting the DHCP reservation resource the IP is still available. You can retrieve it using the `scaleway_ipam_ip` datasource. For instance:
145+
146+
```hcl
147+
data "scaleway_ipam_ip" "existing" {
148+
mac_address = scaleway_instance_private_nic.main.mac_address
149+
type = "ipv4"
150+
}
151+
```
152+
153+
You can now use `data.scaleway_ipam_ip.existing.id` in your configuration to reference the reserved IP.
154+
155+
2. **Book New IPs Using the IPAM IP Resource**
156+
If you need to reserve new IPs, use the `scaleway_ipam_ip` resource. This resource allows you to explicitly book an IP from your private network. For example:
157+
158+
```hcl
159+
resource "scaleway_ipam_ip" "new_ip" {
160+
address = "192.168.1.1"
161+
source {
162+
private_network_id = scaleway_vpc_private_network.main.id
163+
}
164+
}
165+
```
166+
167+
3. **Attach the Reserved IP to Your Resources**
168+
169+
Once you have your IP—whether retrieved via the datasource or booked as a new resource—you can attach it to your server’s private NIC:
170+
171+
```hcl
172+
resource "scaleway_instance_private_nic" "pnic01" {
173+
private_network_id = scaleway_vpc_private_network.main.id
174+
server_id = scaleway_instance_server.main.id
175+
ipam_ip_ids = [scaleway_ipam_ip.new_ip.id]
176+
}
177+
```

docs/resources/vpc_gateway_network.md

+12-58
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ page_title: "Scaleway: scaleway_vpc_gateway_network"
77

88
Creates and manages GatewayNetworks (connections between a Public Gateway and a Private Network).
99

10-
It allows the attachment of Private Networks to Public Gateways and DHCP configurations.
11-
For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#step-3-attach-private-networks-to-the-vpc-public-gateway).
10+
It allows the attachment of Private Networks to Public Gateways.
11+
For more information, see [the API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#step-3-attach-private-networks-to-the-vpc-public-gateway).
1212

1313
## Example Usage
1414

@@ -80,73 +80,27 @@ resource scaleway_vpc_gateway_network main {
8080
}
8181
```
8282

83-
### Create a GatewayNetwork with DHCP
84-
85-
```terraform
86-
resource "scaleway_vpc_private_network" "pn01" {
87-
name = "pn_test_network"
88-
}
89-
90-
resource "scaleway_vpc_public_gateway_ip" "gw01" {
91-
}
92-
93-
resource "scaleway_vpc_public_gateway_dhcp" "dhcp01" {
94-
subnet = "192.168.1.0/24"
95-
push_default_route = true
96-
}
97-
98-
resource "scaleway_vpc_public_gateway" "pg01" {
99-
name = "foobar"
100-
type = "VPC-GW-S"
101-
ip_id = scaleway_vpc_public_gateway_ip.gw01.id
102-
}
103-
104-
resource "scaleway_vpc_gateway_network" "main" {
105-
gateway_id = scaleway_vpc_public_gateway.pg01.id
106-
private_network_id = scaleway_vpc_private_network.pn01.id
107-
dhcp_id = scaleway_vpc_public_gateway_dhcp.dhcp01.id
108-
cleanup_dhcp = true
109-
enable_masquerade = true
110-
}
111-
```
112-
113-
### Create a GatewayNetwork with a static IP address
114-
115-
```terraform
116-
resource scaleway_vpc_private_network pn01 {
117-
name = "pn_test_network"
118-
}
119-
120-
resource scaleway_vpc_public_gateway pg01 {
121-
name = "foobar"
122-
type = "VPC-GW-S"
123-
}
124-
125-
resource scaleway_vpc_gateway_network main {
126-
gateway_id = scaleway_vpc_public_gateway.pg01.id
127-
private_network_id = scaleway_vpc_private_network.pn01.id
128-
enable_dhcp = false
129-
enable_masquerade = true
130-
static_address = "192.168.1.42/24"
131-
}
132-
```
133-
13483
## Argument Reference
13584

13685
The following arguments are supported:
13786

13887
- `gateway_id` - (Required) The ID of the Public Gateway.
13988
- `private_network_id` - (Required) The ID of the Private Network.
140-
- `dhcp_id` - (Required) The ID of the Public Gateway DHCP configuration. Only one of `dhcp_id`, `static_address` and `ipam_config` should be specified.
141-
- `enable_masquerade` - (Defaults to true) Whether masquerade (dynamic NAT) should be enabled on this GatewayNetwork
142-
- `enable_dhcp` - (Defaults to true) Whether a DHCP configuration should be enabled on this GatewayNetwork. Requires a DHCP ID.
143-
- `cleanup_dhcp` - (Defaults to false) Whether to remove DHCP configuration on this GatewayNetwork upon destroy. Requires DHCP ID.
144-
- `static_address` - Enable DHCP configration on this GatewayNetwork. Only one of `dhcp_id`, `static_address` and `ipam_config` should be specified.
14589
- `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.
14690
- `push_default_route` - Defines whether to enable the default route on the GatewayNetwork.
14791
- `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.
14893
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the gateway network should be created.
14994

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+
99+
- `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.
100+
- `enable_dhcp` - (Deprecated) Please use `ipam_config`. Whether a DHCP configuration should be enabled on this GatewayNetwork. Requires a DHCP ID.
101+
- `cleanup_dhcp` - (Deprecated) Please use `ipam_config`. Whether to remove DHCP configuration on this GatewayNetwork upon destroy. Requires DHCP ID.
102+
- `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.
103+
150104
## Attributes Reference
151105

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

docs/resources/vpc_public_gateway.md

+2-1
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

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp"
55

66
# Resource: scaleway_vpc_public_gateway_dhcp
77

8+
~> **Important:** The resource `scaleway_vpc_public_gateway_dhcp` has been deprecated and will no longer be supported.
9+
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).
11+
812
Creates and manages Scaleway VPC Public Gateway DHCP configurations.
913
For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#dhcp-c05544).
1014

docs/resources/vpc_public_gateway_dhcp_reservation.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp_reservation"
55

66
# Resource: scaleway_vpc_public_gateway_dhcp_reservation
77

8+
~> **Important:** The resource `scaleway_vpc_public_gateway_dhcp_reservation` has been deprecated and will no longer be supported.
9+
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. For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md).
11+
812
Creates and manages [Scaleway DHCP Reservations](https://www.scaleway.com/en/docs/vpc/concepts/#dhcp).
913

1014
These static associations are used to assign IP addresses based on the MAC addresses of the resource.

internal/services/k8s/pool_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -476,18 +476,18 @@ func TestAccPool_PublicIPDisabled(t *testing.T) {
476476
resource "scaleway_vpc_private_network" "public_ip" {
477477
name = "test-k8s-public-ip"
478478
}
479+
479480
resource "scaleway_vpc_public_gateway" "public_ip" {
480481
name = "test-k8s-public-ip"
481482
type = "VPC-GW-S"
482483
}
483-
resource "scaleway_vpc_public_gateway_dhcp" "public_ip" {
484-
subnet = "192.168.0.0/22"
485-
push_default_route = true
486-
}
484+
487485
resource "scaleway_vpc_gateway_network" "public_ip" {
488486
gateway_id = scaleway_vpc_public_gateway.public_ip.id
489487
private_network_id = scaleway_vpc_private_network.public_ip.id
490-
dhcp_id = scaleway_vpc_public_gateway_dhcp.public_ip.id
488+
ipam_config {
489+
push_default_route = true
490+
}
491491
}
492492
493493
resource "scaleway_k8s_cluster" "public_ip" {

0 commit comments

Comments
 (0)