@@ -22,12 +22,15 @@ func TestAccDataSourceVPCPublicGatewayPATRule_Basic(t *testing.T) {
2222 type = "VPC-GW-S"
2323 }
2424
25- resource scaleway_vpc_public_gateway_dhcp dhcp01 {
26- subnet = "192.168.1.0/24 "
25+ resource scaleway_vpc vpc01 {
26+ name = "my vpc "
2727 }
2828
2929 resource scaleway_vpc_private_network pn01 {
3030 name = "pn_test_network"
31+ ipv4_subnet {
32+ subnet = "172.16.32.0/22"
33+ }
3134 }
3235 ` ,
3336 },
@@ -37,26 +40,45 @@ func TestAccDataSourceVPCPublicGatewayPATRule_Basic(t *testing.T) {
3740 type = "VPC-GW-S"
3841 }
3942
40- resource scaleway_vpc_public_gateway_dhcp dhcp01 {
41- subnet = "192.168.1.0/24 "
43+ resource scaleway_vpc vpc01 {
44+ name = "my vpc "
4245 }
4346
4447 resource scaleway_vpc_private_network pn01 {
4548 name = "pn_test_network"
49+ ipv4_subnet {
50+ subnet = "172.16.32.0/22"
51+ }
4652 }
4753
4854 resource scaleway_vpc_gateway_network gn01 {
4955 gateway_id = scaleway_vpc_public_gateway.pg01.id
5056 private_network_id = scaleway_vpc_private_network.pn01.id
51- dhcp_id = scaleway_vpc_public_gateway_dhcp.dhcp01.id
52- depends_on = [scaleway_vpc_private_network.pn01]
53- cleanup_dhcp = true
5457 enable_masquerade = true
58+ ipam_config {
59+ push_default_route = true
60+ }
61+ }
62+
63+ ### Scaleway Instance
64+ resource "scaleway_instance_server" "main" {
65+ name = "Scaleway Instance"
66+ type = "DEV1-S"
67+ image = "debian_bullseye"
68+
69+ private_network {
70+ pn_id = scaleway_vpc_private_network.pn01.id
71+ }
72+ }
73+
74+ data "scaleway_ipam_ip" "main" {
75+ mac_address = scaleway_instance_server.main.private_network.0.mac_address
76+ type = "ipv4"
5577 }
5678
5779 resource scaleway_vpc_public_gateway_pat_rule main {
5880 gateway_id = scaleway_vpc_public_gateway.pg01.id
59- private_ip = scaleway_vpc_public_gateway_dhcp.dhcp01 .address
81+ private_ip = data.scaleway_ipam_ip.main .address
6082 private_port = 42
6183 public_port = 42
6284 protocol = "both"
0 commit comments