provider/ns1/record: Fix "use_client_subnet". (#11368)
The support for "use_client_subnet" was half finished. - Field was defined in schema. - ResourceData-to-struct code was present but incorrect. - struct-to-ResourceData code was missing. Made the change and verified with manual testing: 1. In NS1 UI, switched "Use Client Subnet" between checked and unchecked. 2. In Terraform config file, switched "use_client_subnet" field between "true", "false", and omitted. 3. The output of "terraform plan" was as expected in all six cases.
This commit is contained in:
parent
96f6044908
commit
ab18f60071
|
@ -159,6 +159,9 @@ func recordToResourceData(d *schema.ResourceData, r *dns.Record) error {
|
||||||
// t := metaStructToDynamic(r.Meta)
|
// t := metaStructToDynamic(r.Meta)
|
||||||
// d.Set("meta", t)
|
// d.Set("meta", t)
|
||||||
// }
|
// }
|
||||||
|
if r.UseClientSubnet != nil {
|
||||||
|
d.Set("use_client_subnet", *r.UseClientSubnet)
|
||||||
|
}
|
||||||
if len(r.Filters) > 0 {
|
if len(r.Filters) > 0 {
|
||||||
filters := make([]map[string]interface{}, len(r.Filters))
|
filters := make([]map[string]interface{}, len(r.Filters))
|
||||||
for i, f := range r.Filters {
|
for i, f := range r.Filters {
|
||||||
|
@ -261,9 +264,9 @@ func resourceDataToRecord(r *dns.Record, d *schema.ResourceData) error {
|
||||||
// if v, ok := d.GetOk("meta"); ok {
|
// if v, ok := d.GetOk("meta"); ok {
|
||||||
// metaDynamicToStruct(r.Meta, v)
|
// metaDynamicToStruct(r.Meta, v)
|
||||||
// }
|
// }
|
||||||
useClientSubnetVal := d.Get("use_client_subnet").(bool)
|
if v, ok := d.GetOk("use_client_subnet"); ok {
|
||||||
if v := strconv.FormatBool(useClientSubnetVal); v != "" {
|
copy := v.(bool)
|
||||||
r.UseClientSubnet = &useClientSubnetVal
|
r.UseClientSubnet = ©
|
||||||
}
|
}
|
||||||
|
|
||||||
if rawFilters := d.Get("filters").([]interface{}); len(rawFilters) > 0 {
|
if rawFilters := d.Get("filters").([]interface{}); len(rawFilters) > 0 {
|
||||||
|
|
Loading…
Reference in New Issue