@@ -194,6 +194,15 @@ func ResourceVpcSubnetV1() *schema.Resource {
194
194
Optional : true ,
195
195
Computed : true ,
196
196
},
197
+ "dhcp_ipv6_lease_time" : {
198
+ Type : schema .TypeString ,
199
+ Optional : true ,
200
+ Computed : true ,
201
+ },
202
+ "dhcp_domain_name" : {
203
+ Type : schema .TypeString ,
204
+ Optional : true ,
205
+ },
197
206
"subnet_id" : {
198
207
Type : schema .TypeString ,
199
208
Computed : true ,
@@ -231,6 +240,15 @@ func buildDhcpOpts(d *schema.ResourceData, update bool) []subnets.ExtraDhcpOpt {
231
240
result = append (result , addressTime )
232
241
}
233
242
243
+ if v , ok := d .GetOk ("dhcp_ipv6_lease_time" ); ok {
244
+ ipv6AddressVal := v .(string )
245
+ ipv6AddressTime := subnets.ExtraDhcpOpt {
246
+ OptName : "ipv6_addresstime" ,
247
+ OptValue : & ipv6AddressVal ,
248
+ }
249
+ result = append (result , ipv6AddressTime )
250
+ }
251
+
234
252
if v , ok := d .GetOk ("ntp_server_address" ); ok {
235
253
ntpVal := v .(string )
236
254
ntp := subnets.ExtraDhcpOpt {
@@ -245,6 +263,20 @@ func buildDhcpOpts(d *schema.ResourceData, update bool) []subnets.ExtraDhcpOpt {
245
263
result = append (result , ntp )
246
264
}
247
265
266
+ if v , ok := d .GetOk ("dhcp_domain_name" ); ok {
267
+ domainNameVal := v .(string )
268
+ domainName := subnets.ExtraDhcpOpt {
269
+ OptName : "domainname" ,
270
+ OptValue : & domainNameVal ,
271
+ }
272
+ result = append (result , domainName )
273
+ } else if update {
274
+ domainName := subnets.ExtraDhcpOpt {
275
+ OptName : "domainname" ,
276
+ }
277
+ result = append (result , domainName )
278
+ }
279
+
248
280
return result
249
281
}
250
282
@@ -367,10 +399,15 @@ func resourceVpcSubnetRead(_ context.Context, d *schema.ResourceData, meta inter
367
399
368
400
// set dhcp extra opts ntp and addresstime
369
401
for _ , val := range n .ExtraDhcpOpts {
370
- if val .OptName == "ntp" {
402
+ switch val .OptName {
403
+ case "ntp" :
371
404
mErr = multierror .Append (mErr , d .Set ("ntp_server_address" , val .OptValue ))
372
- } else if val . OptName == "addresstime" {
405
+ case "addresstime" :
373
406
mErr = multierror .Append (mErr , d .Set ("dhcp_lease_time" , val .OptValue ))
407
+ case "ipv6_addresstime" :
408
+ mErr = multierror .Append (mErr , d .Set ("dhcp_ipv6_lease_time" , val .OptValue ))
409
+ case "domainname" :
410
+ mErr = multierror .Append (mErr , d .Set ("dhcp_domain_name" , val .OptValue ))
374
411
}
375
412
}
376
413
@@ -419,7 +456,7 @@ func resourceVpcSubnetUpdate(ctx context.Context, d *schema.ResourceData, meta i
419
456
dnsList := utils .ExpandToStringList (d .Get ("dns_list" ).([]interface {}))
420
457
updateOpts .DnsList = & dnsList
421
458
}
422
- if d .HasChanges ("dhcp_lease_time" , "ntp_server_address" ) {
459
+ if d .HasChanges ("dhcp_lease_time" , "ntp_server_address" , "dhcp_ipv6_lease_time" , "dhcp_domain_name" ) {
423
460
updateOpts .ExtraDhcpOpts = buildDhcpOpts (d , true )
424
461
}
425
462
0 commit comments