Skip to content

Commit b8dca3e

Browse files
yfodilremyleone
andauthored
feat(vpcgw): migrate to v2 (#2990)
* bump sdk go * feat(vpcgw): migrate to v2 * bump sdk go * update tests * lint and update tests * fix int type and update pat rule datasource test * update docs * markdown lint * Delete internal/services/vpc/route_datasource.go * add guide link and logs * lint --------- Co-authored-by: Rémy Léone <[email protected]>
1 parent ba041f4 commit b8dca3e

File tree

54 files changed

+14374
-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.

54 files changed

+14374
-23067
lines changed

docs/data-sources/vpc_gateway_network.md

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

docs/resources/vpc_gateway_network.md

Lines changed: 12 additions & 58 deletions
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

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: 4 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 5 additions & 5 deletions
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)