Skip to content

Commit 8ef8dd0

Browse files
authored
fix(vpc_gw_dhcp): Properly set fields that should default to true (#1058)
1 parent 8a2e3fe commit 8ef8dd0

16 files changed

+2574
-2596
lines changed

scaleway/resource_vpc_public_gateway_dhcp.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ func resourceScalewayVPCPublicGatewayDHCP() *schema.Resource {
5353
},
5454
"enable_dynamic": {
5555
Type: schema.TypeBool,
56-
Computed: true,
5756
Optional: true,
57+
Default: true,
5858
Description: "Whether to enable dynamic pooling of IPs. By turning the dynamic pool off, only pre-existing DHCP reservations will be handed out. Defaults to true.",
5959
},
6060
"valid_lifetime": {
@@ -77,14 +77,14 @@ func resourceScalewayVPCPublicGatewayDHCP() *schema.Resource {
7777
},
7878
"push_default_route": {
7979
Type: schema.TypeBool,
80-
Computed: true,
8180
Optional: true,
81+
Default: true,
8282
Description: "Whether the gateway should push a default route to DHCP clients or only hand out IPs. Defaults to true",
8383
},
8484
"push_dns_server": {
8585
Type: schema.TypeBool,
86-
Computed: true,
8786
Optional: true,
87+
Default: true,
8888
Description: "Whether the gateway should push custom DNS servers to clients. This allows for instance hostname -> IP resolution. Defaults to true.",
8989
},
9090
"dns_server_override": {

scaleway/resource_vpc_public_gateway_dhcp_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func testAccCheckScalewayVPCPublicGatewayDHCPExists(tt *TestTools, n string) res
4444
return err
4545
}
4646

47-
_, err = vpcgwAPI.GetDHCP(&vpcgw.GetDHCPRequest{
47+
dhcp, err := vpcgwAPI.GetDHCP(&vpcgw.GetDHCPRequest{
4848
DHCPID: ID,
4949
Zone: zone,
5050
})
@@ -53,6 +53,17 @@ func testAccCheckScalewayVPCPublicGatewayDHCPExists(tt *TestTools, n string) res
5353
return err
5454
}
5555

56+
// Test default values
57+
if !dhcp.EnableDynamic {
58+
return fmt.Errorf("enable_dynamic is false, should default to true")
59+
}
60+
if !dhcp.PushDefaultRoute {
61+
return fmt.Errorf("push_default_route is false, should default to true")
62+
}
63+
if !dhcp.PushDNSServer {
64+
return fmt.Errorf("push_dns_server is false, should default to true")
65+
}
66+
5667
return nil
5768
}
5869
}

scaleway/testdata/data-source-vpc-private-network-basic.cassette.yaml

Lines changed: 124 additions & 159 deletions
Large diffs are not rendered by default.

scaleway/testdata/data-source-vpc-public-gateway-basic.cassette.yaml

Lines changed: 187 additions & 152 deletions
Large diffs are not rendered by default.

scaleway/testdata/data-source-vpc-public-gateway-dhcp-basic.cassette.yaml

Lines changed: 70 additions & 70 deletions
Large diffs are not rendered by default.

scaleway/testdata/data-source-vpc-public-gateway-ip-basic.cassette.yaml

Lines changed: 79 additions & 79 deletions
Large diffs are not rendered by default.

scaleway/testdata/rdb-instance-private-network-dhcp.cassette.yaml

Lines changed: 340 additions & 373 deletions
Large diffs are not rendered by default.

scaleway/testdata/rdb-instance-private-network.cassette.yaml

Lines changed: 502 additions & 565 deletions
Large diffs are not rendered by default.

scaleway/testdata/vpc-gateway-network-basic.cassette.yaml

Lines changed: 292 additions & 292 deletions
Large diffs are not rendered by default.

scaleway/testdata/vpc-gateway-network-without-dhcp.cassette.yaml

Lines changed: 164 additions & 237 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)