Skip to content

Commit

Permalink
fixed txt value read to ignore strings broken down by the server
Browse files Browse the repository at this point in the history
  • Loading branch information
RutvikS-crest committed Mar 14, 2022
1 parent 509df23 commit 1aca123
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions constellix/resource_constellix_txt_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{})
Expand Down Expand Up @@ -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{})
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 1aca123

Please sign in to comment.