@@ -54,7 +54,7 @@ func resourceScalewayVPCPublicGatewayDHCP() *schema.Resource {
54
54
"enable_dynamic" : {
55
55
Type : schema .TypeBool ,
56
56
Optional : true ,
57
- Default : true ,
57
+ Computed : true ,
58
58
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." ,
59
59
},
60
60
"valid_lifetime" : {
@@ -79,7 +79,7 @@ func resourceScalewayVPCPublicGatewayDHCP() *schema.Resource {
79
79
Type : schema .TypeBool ,
80
80
Optional : true ,
81
81
Computed : true ,
82
- Description : "Whether the gateway should push a default route to DHCP clients or only hand out IPs. Defaults to true" ,
82
+ Description : "Whether the gateway should push a default route to DHCP clients or only hand out IPs. Defaults to true. " ,
83
83
},
84
84
"push_dns_server" : {
85
85
Type : schema .TypeBool ,
@@ -93,15 +93,15 @@ func resourceScalewayVPCPublicGatewayDHCP() *schema.Resource {
93
93
Elem : & schema.Schema {
94
94
Type : schema .TypeString ,
95
95
},
96
- Description : "Override the DNS server list pushed to DHCP clients, instead of the gateway itself" ,
96
+ Description : "Override the DNS server list pushed to DHCP clients, instead of the gateway itself. " ,
97
97
},
98
98
"dns_search" : {
99
99
Type : schema .TypeList ,
100
100
Optional : true ,
101
101
Elem : & schema.Schema {
102
102
Type : schema .TypeString ,
103
103
},
104
- Description : "Additional DNS search paths" ,
104
+ Description : "Additional DNS search paths. " ,
105
105
},
106
106
"dns_local_name" : {
107
107
Type : schema .TypeString ,
@@ -113,12 +113,12 @@ func resourceScalewayVPCPublicGatewayDHCP() *schema.Resource {
113
113
"created_at" : {
114
114
Type : schema .TypeString ,
115
115
Computed : true ,
116
- Description : "The date and time of the creation of the public gateway" ,
116
+ Description : "The date and time of the creation of the public gateway. " ,
117
117
},
118
118
"updated_at" : {
119
119
Type : schema .TypeString ,
120
120
Computed : true ,
121
- Description : "The date and time of the last update of the public gateway" ,
121
+ Description : "The date and time of the last update of the public gateway. " ,
122
122
},
123
123
},
124
124
}
@@ -169,23 +169,23 @@ func resourceScalewayVPCPublicGatewayDHCPCreate(ctx context.Context, d *schema.R
169
169
}
170
170
171
171
if renewTimer , ok := d .GetOk ("renew_timer" ); ok {
172
- req .RenewTimer = & scw.Duration {Seconds : renewTimer .(int64 )}
172
+ req .RenewTimer = & scw.Duration {Seconds : int64 ( renewTimer .(int ) )}
173
173
}
174
174
175
175
if validLifetime , ok := d .GetOk ("valid_lifetime" ); ok {
176
- req .ValidLifetime = & scw.Duration {Seconds : validLifetime .(int64 )}
176
+ req .ValidLifetime = & scw.Duration {Seconds : int64 ( validLifetime .(int ) )}
177
177
}
178
178
179
179
if rebindTimer , ok := d .GetOk ("rebind_timer" ); ok {
180
- req .RebindTimer = & scw.Duration {Seconds : rebindTimer .(int64 )}
180
+ req .RebindTimer = & scw.Duration {Seconds : int64 ( rebindTimer .(int ) )}
181
181
}
182
182
183
183
if poolLow , ok := d .GetOk ("pool_low" ); ok {
184
184
req .PoolLow = scw .IPPtr (net .ParseIP (poolLow .(string )))
185
185
}
186
186
187
187
if poolHigh , ok := d .GetOk ("pool_high" ); ok {
188
- req .PoolLow = scw .IPPtr (net .ParseIP (poolHigh .(string )))
188
+ req .PoolHigh = scw .IPPtr (net .ParseIP (poolHigh .(string )))
189
189
}
190
190
191
191
res , err := vpcgwAPI .CreateDHCP (req , scw .WithContext (ctx ))
@@ -244,7 +244,7 @@ func resourceScalewayVPCPublicGatewayDHCPUpdate(ctx context.Context, d *schema.R
244
244
return diag .FromErr (err )
245
245
}
246
246
247
- if d .HasChangesExcept ("subnet" , "address" , "pool_low" , "pool_high" ,
247
+ if d .HasChanges ("subnet" , "address" , "pool_low" , "pool_high" ,
248
248
"enable_dynamic" , "push_default_route" , "push_dns_server" , "dns_servers_override" ,
249
249
"dns_search" , "dns_local_name" , "renew_timer" , "valid_lifetime" , "rebind_timer" ) {
250
250
req := & vpcgw.UpdateDHCPRequest {
@@ -264,25 +264,11 @@ func resourceScalewayVPCPublicGatewayDHCPUpdate(ctx context.Context, d *schema.R
264
264
req .Address = scw .IPPtr (net .ParseIP (address .(string )))
265
265
}
266
266
267
- if poolLow , ok := d .GetOk ("pool_low" ); ok {
268
- req .PoolLow = scw .IPPtr (net .ParseIP (poolLow .(string )))
269
- }
270
-
271
- if poolHigh , ok := d .GetOk ("pool_low" ); ok {
272
- req .PoolHigh = scw .IPPtr (net .ParseIP (poolHigh .(string )))
273
- }
274
-
275
- if pushDefaultRoute , ok := d .GetOk ("push_default_route" ); ok {
276
- req .PushDefaultRoute = expandBoolPtr (pushDefaultRoute )
277
- }
267
+ req .PushDNSServer = expandBoolPtr (d .Get ("push_dns_server" ))
278
268
279
- if pushDNServer , ok := d .GetOk ("push_dns_server" ); ok {
280
- req .PushDNSServer = expandBoolPtr (pushDNServer )
281
- }
269
+ req .EnableDynamic = expandBoolPtr (d .Get ("enable_dynamic" ))
282
270
283
- if enableDynamic , ok := d .GetOk ("enable_dynamic" ); ok {
284
- req .EnableDynamic = expandBoolPtr (enableDynamic )
285
- }
271
+ req .PushDefaultRoute = expandBoolPtr (d .Get ("push_default_route" ))
286
272
287
273
if dnsServerOverride , ok := d .GetOk ("dns_servers_override" ); ok {
288
274
req .DNSServersOverride = expandStringsPtr (dnsServerOverride )
@@ -297,23 +283,23 @@ func resourceScalewayVPCPublicGatewayDHCPUpdate(ctx context.Context, d *schema.R
297
283
}
298
284
299
285
if renewTimer , ok := d .GetOk ("renew_timer" ); ok {
300
- req .RenewTimer = & scw.Duration {Seconds : renewTimer .(int64 )}
286
+ req .RenewTimer = & scw.Duration {Seconds : int64 ( renewTimer .(int ) )}
301
287
}
302
288
303
289
if validLifetime , ok := d .GetOk ("valid_lifetime" ); ok {
304
- req .ValidLifetime = & scw.Duration {Seconds : validLifetime .(int64 )}
290
+ req .ValidLifetime = & scw.Duration {Seconds : int64 ( validLifetime .(int ) )}
305
291
}
306
292
307
293
if rebindTimer , ok := d .GetOk ("rebind_timer" ); ok {
308
- req .RebindTimer = & scw.Duration {Seconds : rebindTimer .(int64 )}
294
+ req .RebindTimer = & scw.Duration {Seconds : int64 ( rebindTimer .(int ) )}
309
295
}
310
296
311
297
if poolLow , ok := d .GetOk ("pool_low" ); ok {
312
298
req .PoolLow = scw .IPPtr (net .ParseIP (poolLow .(string )))
313
299
}
314
300
315
301
if poolHigh , ok := d .GetOk ("pool_high" ); ok {
316
- req .PoolLow = scw .IPPtr (net .ParseIP (poolHigh .(string )))
302
+ req .PoolHigh = scw .IPPtr (net .ParseIP (poolHigh .(string )))
317
303
}
318
304
319
305
_ , err = vpcgwAPI .UpdateDHCP (req , scw .WithContext (ctx ))
0 commit comments