From 1aca1239bb2abb652a533948426803f063fdde2b Mon Sep 17 00:00:00 2001 From: rutvikshiyani_crest Date: Mon, 14 Mar 2022 15:33:03 +0530 Subject: [PATCH] fixed txt value read to ignore strings broken down by the server --- constellix/resource_constellix_txt_record.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/constellix/resource_constellix_txt_record.go b/constellix/resource_constellix_txt_record.go index f9e55d5..a4571bc 100644 --- a/constellix/resource_constellix_txt_record.go +++ b/constellix/resource_constellix_txt_record.go @@ -86,7 +86,7 @@ func resourceConstellixTxt() *schema.Resource { }, "roundrobin": &schema.Schema{ - Type: schema.TypeSet, + Type: schema.TypeList, Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -197,7 +197,7 @@ func resourceConstellixTxtCreate(d *schema.ResourceData, m interface{}) error { if rr, ok := d.GetOk("roundrobin"); ok { mapListRR := make([]interface{}, 0, 1) - tp := rr.(*schema.Set).List() + tp := rr.([]interface{}) for _, val := range tp { tpMap := make(map[string]interface{}) inner := val.(map[string]interface{}) @@ -272,7 +272,7 @@ func resourceConstellixTxtUpdate(d *schema.ResourceData, m interface{}) error { } if rr, ok := d.GetOk("roundrobin"); ok { mapListRR := make([]interface{}, 0, 1) - tp := rr.(*schema.Set).List() + tp := rr.([]interface{}) for _, val := range tp { tpMap := make(map[string]interface{}) inner := val.(map[string]interface{}) @@ -331,7 +331,9 @@ func resourceConstellixTxtRead(d *schema.ResourceData, m interface{}) error { for _, val := range resrr { tpMap := make(map[string]interface{}) inner := val.(map[string]interface{}) - tpMap["value"] = stripQuotes(inner["value"].(string)) // removing the quotes added by the server during the GET call + value := stripQuotes(inner["value"].(string)) + value = strings.ReplaceAll(value, "\" \"", "") + tpMap["value"] = value tpMap["disable_flag"] = inner["disableFlag"].(bool) mapListRR = append(mapListRR, tpMap) }