Skip to content

Commit

Permalink
Merge pull request #47 from Constellix/txt-char-limit-issue
Browse files Browse the repository at this point in the history
fixed txt value read to ignore strings broken down by the server
  • Loading branch information
jr-frazier authored Mar 14, 2022
2 parents 9e7fa41 + 1aca123 commit 210d18c
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 210d18c

Please sign in to comment.