From 9a9330cbafd0807af99c7fcc7a66841e99e62327 Mon Sep 17 00:00:00 2001 From: Yacine FODIL Date: Thu, 20 Mar 2025 11:13:47 +0100 Subject: [PATCH 01/23] docs(vpcgw): add v2 migration guide --- docs/guides/migration_guide_vpcgw_v2.md | 163 ++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 docs/guides/migration_guide_vpcgw_v2.md diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md new file mode 100644 index 0000000000..5b0747b724 --- /dev/null +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -0,0 +1,163 @@ +--- +page_title: "Migrating from Legacy VPC Gateway to v2" +--- + +# Migrating from Legacy VPC Gateway to v2 + +This guide explains how to migrate from the legacy VPC gateway configuration (v1) to the new v2 API. +In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network. +In v2, the public gateway is migrated to use IPAM (IP Address Management) mode. +In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. + +Note: +During migration, you need to trigger the migration call by setting the `migrate_to_v2` flag on your public gateway resource. +You can do this via the Terraform configuration or by using the Scaleway CLI/Console. + +## Prerequisites + +### Ensure the Latest Provider Version + +Ensure your Scaleway provider is updated to at least version `2.52.0`. + +```hcl +terraform { + required_providers { + scaleway = { + source = "scaleway/scaleway" + version = "~> v2.52.0" + } + } +} +``` + +### Legacy Configuration + +A typical legacy configuration might look like this: + +```hcl +resource "scaleway_vpc" "main" { + name = "foo" +} + +resource "scaleway_vpc_private_network" "main" { + name = "bar" + vpc_id = scaleway_vpc.main.id +} + +resource "scaleway_vpc_public_gateway_ip" "main" { +} + +resource "scaleway_vpc_public_gateway" "main" { + name = "foobar" + type = "VPC-GW-S" + ip_id = scaleway_vpc_public_gateway_ip.main.id +} + +resource "scaleway_vpc_public_gateway_dhcp" "main" { + subnet = "192.168.1.0/24" +} + +resource "scaleway_instance_server" "main" { + image = "ubuntu_focal" + type = "DEV1-S" +} + +resource "scaleway_instance_private_nic" "main" { + server_id = scaleway_instance_server.main.id + private_network_id = scaleway_vpc_private_network.main.id +} + +resource "scaleway_vpc_gateway_network" "main" { + gateway_id = scaleway_vpc_public_gateway.main.id + private_network_id = scaleway_vpc_private_network.main.id + dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id + cleanup_dhcp = true + enable_masquerade = true +} + +resource "scaleway_vpc_public_gateway_dhcp_reservation" "main" { + gateway_network_id = scaleway_vpc_gateway_network.main.id + mac_address = scaleway_instance_private_nic.main.mac_address + ip_address = "192.168.1.1" +} +``` + +### Triggering Migration + +Before updating your configuration, you must trigger the migration on the public gateway resource. For example, add the `migrate_to_v2` flag: + +```hcl +resource "scaleway_vpc_public_gateway" "main" { + name = "foobar" + type = "VPC-GW-S" + ip_id = scaleway_vpc_public_gateway_ip.main.id + migrate_to_v2 = true +} +``` + +This call updates the gateway on the API side from v1 to v2. The DHCP configuration and reservations remain intact, but the underlying resource is now managed using v2. + +### Updated Configuration + +After triggering the migration, update your Terraform configuration as follows: + +1. **Remove the DHCP and DHCP Reservation Resources** + + Since DHCP functionality is built directly into Private Networks, you no longer need the DHCP configuration resources. Delete the following from your config: + + `scaleway_vpc_public_gateway_dhcp` + `scaleway_vpc_public_gateway_dhcp_reservation` + +2. **Update the Gateway Network** + + Replace the DHCP related attributes with an `ipam_config` block. For example + + ```hcl + resource "scaleway_vpc_gateway_network" "main" { + gateway_id = scaleway_vpc_public_gateway.main.id + private_network_id = scaleway_vpc_private_network.main.id + ipam_config { + push_default_route = false + } + enable_masquerade = true + } + ``` + +### Using the IPAM Datasource and Resource for Reservations + +After migrating your public gateway to v2, you no longer manage DHCP reservations with dedicated resources. +Instead, you remove the legacy DHCP reservation resource and switch to using IPAM to manage your IPs. + +1. **Retrieve an Existing IP with the IPAM Datasource** + 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 reference it using the `scaleway_ipam_ip` datasource. For instance: + + ```hcl + data "scaleway_ipam_ip" "existing" { + mac_address = scaleway_instance_private_nic.main.mac_address + type = "ipv4" + } + ``` + You can now use data.scaleway_ipam_ip.existing.id in your configuration to reference the reserved IP. + +2. **Book New IPs Using the IPAM IP Resource** + 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: + + ```hcl + resource "scaleway_ipam_ip" "new_ip" { + address = "172.16.64.7" + source { + private_network_id = scaleway_vpc_private_network.pn01.id + } + } + ``` + +3. **Attach the Reserved IP to Your Resources** + + 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: + ```hcl + resource "scaleway_instance_private_nic" "pnic01" { + private_network_id = scaleway_vpc_private_network.main.id + server_id = scaleway_instance_server.main.id + ipam_ip_ids = [scaleway_ipam_ip.new_ip.id] + } + ``` From 1a1c64a02d41463770d1dff8943f53bda90eb5b1 Mon Sep 17 00:00:00 2001 From: Yacine FODIL Date: Thu, 20 Mar 2025 11:23:25 +0100 Subject: [PATCH 02/23] fix lint --- docs/guides/migration_guide_vpcgw_v2.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 5b0747b724..2748976ad1 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -4,13 +4,13 @@ page_title: "Migrating from Legacy VPC Gateway to v2" # Migrating from Legacy VPC Gateway to v2 -This guide explains how to migrate from the legacy VPC gateway configuration (v1) to the new v2 API. -In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network. +This guide explains how to migrate from the legacy VPC gateway configuration (v1) to the new v2 API. +In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network. In v2, the public gateway is migrated to use IPAM (IP Address Management) mode. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. Note: -During migration, you need to trigger the migration call by setting the `migrate_to_v2` flag on your public gateway resource. +During migration, you need to trigger the migration call by setting the `migrate_to_v2` flag on your public gateway resource. You can do this via the Terraform configuration or by using the Scaleway CLI/Console. ## Prerequisites @@ -111,7 +111,7 @@ After triggering the migration, update your Terraform configuration as follows: 2. **Update the Gateway Network** Replace the DHCP related attributes with an `ipam_config` block. For example - + ```hcl resource "scaleway_vpc_gateway_network" "main" { gateway_id = scaleway_vpc_public_gateway.main.id @@ -125,7 +125,7 @@ After triggering the migration, update your Terraform configuration as follows: ### Using the IPAM Datasource and Resource for Reservations -After migrating your public gateway to v2, you no longer manage DHCP reservations with dedicated resources. +After migrating your public gateway to v2, you no longer manage DHCP reservations with dedicated resources. Instead, you remove the legacy DHCP reservation resource and switch to using IPAM to manage your IPs. 1. **Retrieve an Existing IP with the IPAM Datasource** @@ -137,6 +137,7 @@ Instead, you remove the legacy DHCP reservation resource and switch to using IPA type = "ipv4" } ``` + You can now use data.scaleway_ipam_ip.existing.id in your configuration to reference the reserved IP. 2. **Book New IPs Using the IPAM IP Resource** @@ -153,8 +154,9 @@ Instead, you remove the legacy DHCP reservation resource and switch to using IPA 3. **Attach the Reserved IP to Your Resources** - 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: - ```hcl + 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: + + ```hcl resource "scaleway_instance_private_nic" "pnic01" { private_network_id = scaleway_vpc_private_network.main.id server_id = scaleway_instance_server.main.id From 571614c064556700b819b4125cd5d6339ed90263 Mon Sep 17 00:00:00 2001 From: Yacine FODIL Date: Thu, 20 Mar 2025 11:27:57 +0100 Subject: [PATCH 03/23] fix lint --- docs/guides/migration_guide_vpcgw_v2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 2748976ad1..2f090587dd 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -137,7 +137,7 @@ Instead, you remove the legacy DHCP reservation resource and switch to using IPA type = "ipv4" } ``` - + You can now use data.scaleway_ipam_ip.existing.id in your configuration to reference the reserved IP. 2. **Book New IPs Using the IPAM IP Resource** @@ -155,7 +155,7 @@ Instead, you remove the legacy DHCP reservation resource and switch to using IPA 3. **Attach the Reserved IP to Your Resources** 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: - + ```hcl resource "scaleway_instance_private_nic" "pnic01" { private_network_id = scaleway_vpc_private_network.main.id From de9c49476f449c75bb3fbc3561f3fcfe5d85c1f2 Mon Sep 17 00:00:00 2001 From: Yacine FODIL Date: Thu, 20 Mar 2025 15:05:34 +0100 Subject: [PATCH 04/23] tabs --- docs/guides/migration_guide_vpcgw_v2.md | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 2f090587dd..14e4705699 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -36,49 +36,49 @@ A typical legacy configuration might look like this: ```hcl resource "scaleway_vpc" "main" { - name = "foo" + name = "foo" } resource "scaleway_vpc_private_network" "main" { - name = "bar" - vpc_id = scaleway_vpc.main.id + name = "bar" + vpc_id = scaleway_vpc.main.id } resource "scaleway_vpc_public_gateway_ip" "main" { } resource "scaleway_vpc_public_gateway" "main" { - name = "foobar" - type = "VPC-GW-S" - ip_id = scaleway_vpc_public_gateway_ip.main.id + name = "foobar" + type = "VPC-GW-S" + ip_id = scaleway_vpc_public_gateway_ip.main.id } resource "scaleway_vpc_public_gateway_dhcp" "main" { - subnet = "192.168.1.0/24" + subnet = "192.168.1.0/24" } resource "scaleway_instance_server" "main" { - image = "ubuntu_focal" - type = "DEV1-S" + image = "ubuntu_focal" + type = "DEV1-S" } resource "scaleway_instance_private_nic" "main" { - server_id = scaleway_instance_server.main.id - private_network_id = scaleway_vpc_private_network.main.id + server_id = scaleway_instance_server.main.id + private_network_id = scaleway_vpc_private_network.main.id } resource "scaleway_vpc_gateway_network" "main" { - gateway_id = scaleway_vpc_public_gateway.main.id - private_network_id = scaleway_vpc_private_network.main.id - dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id - cleanup_dhcp = true - enable_masquerade = true + gateway_id = scaleway_vpc_public_gateway.main.id + private_network_id = scaleway_vpc_private_network.main.id + dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id + cleanup_dhcp = true + enable_masquerade = true } resource "scaleway_vpc_public_gateway_dhcp_reservation" "main" { - gateway_network_id = scaleway_vpc_gateway_network.main.id - mac_address = scaleway_instance_private_nic.main.mac_address - ip_address = "192.168.1.1" + gateway_network_id = scaleway_vpc_gateway_network.main.id + mac_address = scaleway_instance_private_nic.main.mac_address + ip_address = "192.168.1.1" } ``` From 2d7c063a5c41276d65cc6e3646361f77951aa2c8 Mon Sep 17 00:00:00 2001 From: Yacine FODIL Date: Thu, 20 Mar 2025 15:20:34 +0100 Subject: [PATCH 05/23] add title --- docs/guides/migration_guide_vpcgw_v2.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 14e4705699..2c2abbd8a3 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -30,6 +30,8 @@ terraform { } ``` +## Migration steps + ### Legacy Configuration A typical legacy configuration might look like this: From 940bb133400b733b423ef33fea4c49acc4eb2d02 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:51:07 +0100 Subject: [PATCH 06/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 2c2abbd8a3..8815517691 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -1,5 +1,5 @@ --- -page_title: "Migrating from Legacy VPC Gateway to v2" +page_title: "Moving a Public Gateway from Legacy mode to IPAM mode, for v2 compatibility" --- # Migrating from Legacy VPC Gateway to v2 From f3e795935faf88c7448436e285794309739d54e4 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:51:15 +0100 Subject: [PATCH 07/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 8815517691..9442c2abf2 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -2,7 +2,7 @@ page_title: "Moving a Public Gateway from Legacy mode to IPAM mode, for v2 compatibility" --- -# Migrating from Legacy VPC Gateway to v2 +# Moving a Public Gateway from Legacy mode to IPAM mode. This guide explains how to migrate from the legacy VPC gateway configuration (v1) to the new v2 API. In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network. From 6f16dc22901b02bb4b0f797f681821a4514b0dc5 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:51:38 +0100 Subject: [PATCH 08/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 9442c2abf2..9feb1ace95 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -4,7 +4,7 @@ page_title: "Moving a Public Gateway from Legacy mode to IPAM mode, for v2 compa # Moving a Public Gateway from Legacy mode to IPAM mode. -This guide explains how to migrate from the legacy VPC gateway configuration (v1) to the new v2 API. +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 later this year. In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network. In v2, the public gateway is migrated to use IPAM (IP Address Management) mode. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. From 0fc7a3e3a3c407208392fa974b3941a600ddf7c3 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:51:57 +0100 Subject: [PATCH 09/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 9feb1ace95..10f89dae9d 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -6,7 +6,7 @@ page_title: "Moving a Public Gateway from Legacy mode to IPAM mode, for v2 compa 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 later this year. In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network. -In v2, the public gateway is migrated to use IPAM (IP Address Management) mode. +In IPAM mode, these functionalities are managed by Scaleway IPAM. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. Note: From 13b1646009b64cd63c1905a383b430a919db895f Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:52:34 +0100 Subject: [PATCH 10/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 10f89dae9d..81b14fdaab 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -17,7 +17,7 @@ You can do this via the Terraform configuration or by using the Scaleway CLI/Con ### Ensure the Latest Provider Version -Ensure your Scaleway provider is updated to at least version `2.52.0`. +Ensure your Scaleway Terraform provider is updated to at least version `2.52.0`. ```hcl terraform { From 2ca580d41289664fa66470c5a6831aa99cc24546 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:52:44 +0100 Subject: [PATCH 11/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 81b14fdaab..605aa80fb4 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -84,7 +84,7 @@ resource "scaleway_vpc_public_gateway_dhcp_reservation" "main" { } ``` -### Triggering Migration +### Triggering the move to IPAM-mode Before updating your configuration, you must trigger the migration on the public gateway resource. For example, add the `migrate_to_v2` flag: From ef3c68db4c22d7120b2762e20e4a256ae53df958 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:52:58 +0100 Subject: [PATCH 12/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 605aa80fb4..164ad012be 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -86,7 +86,7 @@ resource "scaleway_vpc_public_gateway_dhcp_reservation" "main" { ### Triggering the move to IPAM-mode -Before updating your configuration, you must trigger the migration on the public gateway resource. For example, add the `migrate_to_v2` flag: +Before updating your configuration, you must trigger the move to IPAM-mode on the Public Gateway resource. For example, add the `migrate_to_v2` flag: ```hcl resource "scaleway_vpc_public_gateway" "main" { From 88b529491ad710068ad56fd064f8d0d3b3c8dc60 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:53:07 +0100 Subject: [PATCH 13/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 164ad012be..8721909c57 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -101,7 +101,7 @@ This call updates the gateway on the API side from v1 to v2. The DHCP configurat ### Updated Configuration -After triggering the migration, update your Terraform configuration as follows: +After triggering the move, update your Terraform configuration as follows: 1. **Remove the DHCP and DHCP Reservation Resources** From 69991e82e0f4a810da8c6e2e9e4b38b5e9125957 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:53:22 +0100 Subject: [PATCH 14/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 8721909c57..e644dc9736 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -127,7 +127,7 @@ After triggering the move, update your Terraform configuration as follows: ### Using the IPAM Datasource and Resource for Reservations -After migrating your public gateway to v2, you no longer manage DHCP reservations with dedicated resources. +After putting your Public Gateway in IPAM mode, you no longer manage DHCP reservations with dedicated resources. Instead, you remove the legacy DHCP reservation resource and switch to using IPAM to manage your IPs. 1. **Retrieve an Existing IP with the IPAM Datasource** From 6677eeedd2488e9c6a8618ef67c63e70d5f85932 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:53:40 +0100 Subject: [PATCH 15/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index e644dc9736..47d559b341 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -97,7 +97,7 @@ resource "scaleway_vpc_public_gateway" "main" { } ``` -This call updates the gateway on the API side from v1 to v2. The DHCP configuration and reservations remain intact, but the underlying resource is now managed using v2. +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. ### Updated Configuration From 8c15a691529a92331d896ee28b8e8dd361b0336e Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:54:04 +0100 Subject: [PATCH 16/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 47d559b341..10c884f45d 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -10,7 +10,7 @@ In IPAM mode, these functionalities are managed by Scaleway IPAM. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. Note: -During migration, you need to trigger the migration call by setting the `migrate_to_v2` flag on your public gateway resource. +Trigger the move from Legacy mode to IPAM mide by setting the `migrate_to_v2` flag on your Public Gateway resource. You can do this via the Terraform configuration or by using the Scaleway CLI/Console. ## Prerequisites From a60e929a3095c76a2360653c56924d16360aac1a Mon Sep 17 00:00:00 2001 From: Yacine FODIL Date: Fri, 21 Mar 2025 12:50:49 +0100 Subject: [PATCH 17/23] fixes --- docs/guides/migration_guide_vpcgw_v2.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 10c884f45d..5d472a5c97 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -10,7 +10,7 @@ In IPAM mode, these functionalities are managed by Scaleway IPAM. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. Note: -Trigger the move from Legacy mode to IPAM mide by setting the `migrate_to_v2` flag on your Public Gateway resource. +Trigger the move from Legacy mode to IPAM mode by setting the `move_to_ipam` flag on your Public Gateway resource. You can do this via the Terraform configuration or by using the Scaleway CLI/Console. ## Prerequisites @@ -30,7 +30,7 @@ terraform { } ``` -## Migration steps +## Steps to Move to IPAM Mode ### Legacy Configuration @@ -86,14 +86,14 @@ resource "scaleway_vpc_public_gateway_dhcp_reservation" "main" { ### Triggering the move to IPAM-mode -Before updating your configuration, you must trigger the move to IPAM-mode on the Public Gateway resource. For example, add the `migrate_to_v2` flag: +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: ```hcl resource "scaleway_vpc_public_gateway" "main" { name = "foobar" type = "VPC-GW-S" ip_id = scaleway_vpc_public_gateway_ip.main.id - migrate_to_v2 = true + move_to_ipam = true } ``` @@ -118,10 +118,10 @@ After triggering the move, update your Terraform configuration as follows: resource "scaleway_vpc_gateway_network" "main" { gateway_id = scaleway_vpc_public_gateway.main.id private_network_id = scaleway_vpc_private_network.main.id + enable_masquerade = true ipam_config { push_default_route = false } - enable_masquerade = true } ``` @@ -131,7 +131,7 @@ After putting your Public Gateway in IPAM mode, you no longer manage DHCP reserv Instead, you remove the legacy DHCP reservation resource and switch to using IPAM to manage your IPs. 1. **Retrieve an Existing IP with the IPAM Datasource** - 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 reference it using the `scaleway_ipam_ip` datasource. For instance: + 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: ```hcl data "scaleway_ipam_ip" "existing" { @@ -147,9 +147,9 @@ Instead, you remove the legacy DHCP reservation resource and switch to using IPA ```hcl resource "scaleway_ipam_ip" "new_ip" { - address = "172.16.64.7" + address = "192.168.1.1" source { - private_network_id = scaleway_vpc_private_network.pn01.id + private_network_id = scaleway_vpc_private_network.main.id } } ``` From 11f8a900984c85964c960836c67fd9ed3fba74a7 Mon Sep 17 00:00:00 2001 From: Yacine FODIL Date: Fri, 21 Mar 2025 14:00:56 +0100 Subject: [PATCH 18/23] lint --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 5d472a5c97..a9ce0274b9 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -2,7 +2,7 @@ page_title: "Moving a Public Gateway from Legacy mode to IPAM mode, for v2 compatibility" --- -# Moving a Public Gateway from Legacy mode to IPAM mode. +# Moving a Public Gateway from Legacy mode to IPAM mode 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 later this year. In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network. From fe580d77ae080f4bebf8a27bda89e7e7fb622b98 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Mon, 24 Mar 2025 09:59:53 +0100 Subject: [PATCH 19/23] Update docs/guides/migration_guide_vpcgw_v2.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rémy Léone --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index a9ce0274b9..1b064535b5 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -140,7 +140,7 @@ Instead, you remove the legacy DHCP reservation resource and switch to using IPA } ``` - You can now use data.scaleway_ipam_ip.existing.id in your configuration to reference the reserved IP. + You can now use `data.scaleway_ipam_ip.existing.id` in your configuration to reference the reserved IP. 2. **Book New IPs Using the IPAM IP Resource** 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: From 29619c589648e71beb6a9eb253ff8980c0ec6b96 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Mon, 24 Mar 2025 10:00:02 +0100 Subject: [PATCH 20/23] Update docs/guides/migration_guide_vpcgw_v2.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rémy Léone --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 1b064535b5..c0dc6313ba 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -4,7 +4,7 @@ page_title: "Moving a Public Gateway from Legacy mode to IPAM mode, for v2 compa # Moving a Public Gateway from Legacy mode to IPAM mode -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 later this year. +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. In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network. In IPAM mode, these functionalities are managed by Scaleway IPAM. In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. From 9d76bc69f91a622ce0de0a186e6a3ec5e2ccfaf1 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Mon, 24 Mar 2025 10:00:12 +0100 Subject: [PATCH 21/23] Update docs/guides/migration_guide_vpcgw_v2.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rémy Léone --- docs/guides/migration_guide_vpcgw_v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index c0dc6313ba..85a0acd958 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -143,7 +143,7 @@ Instead, you remove the legacy DHCP reservation resource and switch to using IPA You can now use `data.scaleway_ipam_ip.existing.id` in your configuration to reference the reserved IP. 2. **Book New IPs Using the IPAM IP Resource** - 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: + 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: ```hcl resource "scaleway_ipam_ip" "new_ip" { From b564201e4979cdc095dab51433dcc5ea64977823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Mon, 24 Mar 2025 10:56:15 +0100 Subject: [PATCH 22/23] Update docs/guides/migration_guide_vpcgw_v2.md Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- docs/guides/migration_guide_vpcgw_v2.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index 85a0acd958..ca592569ee 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -7,7 +7,9 @@ page_title: "Moving a Public Gateway from Legacy mode to IPAM mode, for v2 compa 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. In the legacy setup, DHCP and DHCP reservations are managed with dedicated resources and referenced in the gateway network. In IPAM mode, these functionalities are managed by Scaleway IPAM. -In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. +In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed on the Public Gateway itself. + +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/). Note: Trigger the move from Legacy mode to IPAM mode by setting the `move_to_ipam` flag on your Public Gateway resource. From a812852b7bfc68621a7665d0a724ad1cac0b0e79 Mon Sep 17 00:00:00 2001 From: Yacine FODIL Date: Mon, 24 Mar 2025 11:09:40 +0100 Subject: [PATCH 23/23] add cli command --- docs/guides/migration_guide_vpcgw_v2.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/guides/migration_guide_vpcgw_v2.md b/docs/guides/migration_guide_vpcgw_v2.md index ca592569ee..0fb5734746 100644 --- a/docs/guides/migration_guide_vpcgw_v2.md +++ b/docs/guides/migration_guide_vpcgw_v2.md @@ -15,6 +15,14 @@ Note: Trigger the move from Legacy mode to IPAM mode by setting the `move_to_ipam` flag on your Public Gateway resource. You can do this via the Terraform configuration or by using the Scaleway CLI/Console. +Using the CLI: +Ensure you have at least version v2.38.0 of the Scaleway CLI installed. Then run: + +```bash +scw vpc-gw gateway move-to-ipam 'id-of-the-public-gateway' +``` + + ## Prerequisites ### Ensure the Latest Provider Version