@@ -74,6 +74,62 @@ func TestAccScalewayVPCPublicGatewayDHCPEntry_Basic(t *testing.T) {
74
74
resource .TestCheckResourceAttrSet ("scaleway_vpc_public_gateway_dhcp_reservation.main" , "type" ),
75
75
),
76
76
},
77
+ {
78
+ Config : `
79
+ resource scaleway_vpc_private_network main {
80
+ name = "pn_test_network"
81
+ }
82
+
83
+ resource "scaleway_instance_server" "main" {
84
+ image = "ubuntu_focal"
85
+ type = "DEV1-S"
86
+ zone = "fr-par-1"
87
+
88
+ private_network {
89
+ pn_id = scaleway_vpc_private_network.main.id
90
+ }
91
+ }
92
+
93
+ resource scaleway_vpc_public_gateway_ip main {
94
+ }
95
+
96
+ resource scaleway_vpc_public_gateway_dhcp main {
97
+ subnet = "192.168.1.0/24"
98
+ }
99
+
100
+ resource scaleway_vpc_public_gateway main {
101
+ name = "foobar"
102
+ type = "VPC-GW-S"
103
+ ip_id = scaleway_vpc_public_gateway_ip.main.id
104
+ }
105
+
106
+ resource scaleway_vpc_gateway_network main {
107
+ gateway_id = scaleway_vpc_public_gateway.main.id
108
+ private_network_id = scaleway_vpc_private_network.main.id
109
+ dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id
110
+ cleanup_dhcp = true
111
+ enable_masquerade = true
112
+ depends_on = [scaleway_vpc_public_gateway_ip.main, scaleway_vpc_private_network.main]
113
+ }
114
+
115
+ resource scaleway_vpc_public_gateway_dhcp_reservation main {
116
+ gateway_network_id = scaleway_vpc_gateway_network.main.id
117
+ mac_address = scaleway_instance_server.main.private_network.0.mac_address
118
+ ip_address = "192.168.1.2"
119
+ }
120
+ ` ,
121
+ Check : resource .ComposeTestCheckFunc (
122
+ testAccCheckScalewayVPCPublicGatewayDHCPReservationExists (tt , "scaleway_vpc_public_gateway_dhcp_reservation.main" ),
123
+ resource .TestCheckResourceAttrPair ("scaleway_vpc_public_gateway_dhcp_reservation.main" ,
124
+ "mac_address" , "scaleway_instance_server.main" , "private_network.0.mac_address" ),
125
+ resource .TestCheckResourceAttrPair ("scaleway_vpc_public_gateway_dhcp_reservation.main" , "gateway_network_id" ,
126
+ "scaleway_vpc_gateway_network.main" , "id" ),
127
+ resource .TestCheckResourceAttr ("scaleway_vpc_public_gateway_dhcp_reservation.main" , "ip_address" , "192.168.1.2" ),
128
+ resource .TestCheckResourceAttrSet ("scaleway_vpc_public_gateway_dhcp_reservation.main" , "created_at" ),
129
+ resource .TestCheckResourceAttrSet ("scaleway_vpc_public_gateway_dhcp_reservation.main" , "updated_at" ),
130
+ resource .TestCheckResourceAttrSet ("scaleway_vpc_public_gateway_dhcp_reservation.main" , "type" ),
131
+ ),
132
+ },
77
133
},
78
134
})
79
135
}
0 commit comments