Skip to content

feat(vpcgw): migrate to v2 #2990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/data-sources/vpc_gateway_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ data scaleway_vpc_gateway_network by_gateway_and_pn {
* `gateway_id` - (Optional) ID of the Public Gateway the GatewayNetwork is linked to
* `private_network_id` - (Optional) ID of the Private Network the GatewayNetwork is linked to
* `enable_masquerade` - (Optional) Whether masquerade (dynamic NAT) is enabled on requested GatewayNetwork
* `dhcp_id` - (Optional) ID of the Public Gateway's DHCP configuration
* `dhcp_id` - (Deprecated) ID of the Public Gateway's DHCP configuration

## Attributes Reference

Expand Down
4 changes: 4 additions & 0 deletions docs/data-sources/vpc_public_gateway_dhcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp"

# scaleway_vpc_public_gateway_dhcp

~> **Important:** The data source `scaleway_vpc_public_gateway_dhcp` has been deprecated and will no longer be supported.
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](../guides/migration_guide_vpcgw_v2.md).

Gets information about a Public Gateway DHCP configuration.

## Example Usage
Expand Down
4 changes: 4 additions & 0 deletions docs/data-sources/vpc_public_gateway_dhcp_reservation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp_reservation"

# scaleway_vpc_public_gateway_dhcp_reservation

~> **Important:** The data source `scaleway_vpc_public_gateway_dhcp_reservation` has been deprecated and will no longer be supported.
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](../guides/migration_guide_vpcgw_v2.md).

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

Expand Down
70 changes: 12 additions & 58 deletions docs/resources/vpc_gateway_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ page_title: "Scaleway: scaleway_vpc_gateway_network"

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

It allows the attachment of Private Networks to Public Gateways and DHCP configurations.
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).
It allows the attachment of Private Networks to Public Gateways.
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).

## Example Usage

Expand Down Expand Up @@ -80,73 +80,27 @@ resource scaleway_vpc_gateway_network main {
}
```

### Create a GatewayNetwork with DHCP

```terraform
resource "scaleway_vpc_private_network" "pn01" {
name = "pn_test_network"
}

resource "scaleway_vpc_public_gateway_ip" "gw01" {
}

resource "scaleway_vpc_public_gateway_dhcp" "dhcp01" {
subnet = "192.168.1.0/24"
push_default_route = true
}

resource "scaleway_vpc_public_gateway" "pg01" {
name = "foobar"
type = "VPC-GW-S"
ip_id = scaleway_vpc_public_gateway_ip.gw01.id
}

resource "scaleway_vpc_gateway_network" "main" {
gateway_id = scaleway_vpc_public_gateway.pg01.id
private_network_id = scaleway_vpc_private_network.pn01.id
dhcp_id = scaleway_vpc_public_gateway_dhcp.dhcp01.id
cleanup_dhcp = true
enable_masquerade = true
}
```

### Create a GatewayNetwork with a static IP address

```terraform
resource scaleway_vpc_private_network pn01 {
name = "pn_test_network"
}

resource scaleway_vpc_public_gateway pg01 {
name = "foobar"
type = "VPC-GW-S"
}

resource scaleway_vpc_gateway_network main {
gateway_id = scaleway_vpc_public_gateway.pg01.id
private_network_id = scaleway_vpc_private_network.pn01.id
enable_dhcp = false
enable_masquerade = true
static_address = "192.168.1.42/24"
}
```

## Argument Reference

The following arguments are supported:

- `gateway_id` - (Required) The ID of the Public Gateway.
- `private_network_id` - (Required) The ID of the Private Network.
- `dhcp_id` - (Required) The ID of the Public Gateway DHCP configuration. Only one of `dhcp_id`, `static_address` and `ipam_config` should be specified.
- `enable_masquerade` - (Defaults to true) Whether masquerade (dynamic NAT) should be enabled on this GatewayNetwork
- `enable_dhcp` - (Defaults to true) Whether a DHCP configuration should be enabled on this GatewayNetwork. Requires a DHCP ID.
- `cleanup_dhcp` - (Defaults to false) Whether to remove DHCP configuration on this GatewayNetwork upon destroy. Requires DHCP ID.
- `static_address` - Enable DHCP configration on this GatewayNetwork. Only one of `dhcp_id`, `static_address` and `ipam_config` should be specified.
- `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.
- `push_default_route` - Defines whether to enable the default route on the GatewayNetwork.
- `ipam_ip_id` - Use this IPAM-booked IP ID as the Gateway's IP in this Private Network.
- `enable_masquerade` - (Defaults to true) Whether masquerade (dynamic NAT) should be enabled on this GatewayNetwork.
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the gateway network should be created.

~> **Important:**
In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP fields are now deprecated.
For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md).

- `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.
- `enable_dhcp` - (Deprecated) Please use `ipam_config`. Whether a DHCP configuration should be enabled on this GatewayNetwork. Requires a DHCP ID.
- `cleanup_dhcp` - (Deprecated) Please use `ipam_config`. Whether to remove DHCP configuration on this GatewayNetwork upon destroy. Requires DHCP ID.
- `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.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:
Expand Down
3 changes: 2 additions & 1 deletion docs/resources/vpc_public_gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ The following arguments are supported:
- `tags` - (Optional) The tags to associate with the Public Gateway.
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the Public Gateway should be created.
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the public gateway is associated with.
- `upstream_dns_servers` - (Optional) Override the gateway's default recursive DNS servers, if DNS features are enabled.
- `upstream_dns_servers` - (Deprecated) Override the gateway's default recursive DNS servers, if DNS features are enabled.
- `ip_id` - (Optional) Attach an existing flexible IP to the gateway.
- `bastion_enabled` - (Optional) Enable SSH bastion on the gateway.
- `bastion_port` - (Optional) The port on which the SSH bastion will listen.
- `allowed_ip_ranges` - (Optional) Set a definitive list of IP ranges (in CIDR notation) allowed to connect to the SSH bastion.
- `enable_smtp` - (Optional) Enable SMTP on the gateway.
- `refresh_ssh_keys` - (Optional) Trigger a refresh of the SSH keys on the Public Gateway by changing this field's value.

Expand Down
4 changes: 4 additions & 0 deletions docs/resources/vpc_public_gateway_dhcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp"

# Resource: scaleway_vpc_public_gateway_dhcp

~> **Important:** The resource `scaleway_vpc_public_gateway_dhcp` has been deprecated and will no longer be supported.
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](../guides/migration_guide_vpcgw_v2.md).

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

Expand Down
4 changes: 4 additions & 0 deletions docs/resources/vpc_public_gateway_dhcp_reservation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp_reservation"

# Resource: scaleway_vpc_public_gateway_dhcp_reservation

~> **Important:** The resource `scaleway_vpc_public_gateway_dhcp_reservation` has been deprecated and will no longer be supported.
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](../guides/migration_guide_vpcgw_v2.md).

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

These static associations are used to assign IP addresses based on the MAC addresses of the resource.
Expand Down
10 changes: 5 additions & 5 deletions internal/services/k8s/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,18 +476,18 @@ func TestAccPool_PublicIPDisabled(t *testing.T) {
resource "scaleway_vpc_private_network" "public_ip" {
name = "test-k8s-public-ip"
}

resource "scaleway_vpc_public_gateway" "public_ip" {
name = "test-k8s-public-ip"
type = "VPC-GW-S"
}
resource "scaleway_vpc_public_gateway_dhcp" "public_ip" {
subnet = "192.168.0.0/22"
push_default_route = true
}

resource "scaleway_vpc_gateway_network" "public_ip" {
gateway_id = scaleway_vpc_public_gateway.public_ip.id
private_network_id = scaleway_vpc_private_network.public_ip.id
dhcp_id = scaleway_vpc_public_gateway_dhcp.public_ip.id
ipam_config {
push_default_route = true
}
}

resource "scaleway_k8s_cluster" "public_ip" {
Expand Down
Loading
Loading