Skip to content

Commit 5e317d2

Browse files
authored
fix for using display_text as a filter in template datasource (#43)
Fixed in #42
1 parent 4f10ec3 commit 5e317d2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cloudstack/data_source_cloudstack_template.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"fmt"
2525
"log"
2626
"regexp"
27+
"strings"
2728
"time"
2829

2930
"github.com/apache/cloudstack-go/v2/cloudstack"
@@ -180,8 +181,8 @@ func applyFilters(template *cloudstack.Template, filters *schema.Set) (bool, err
180181
if err != nil {
181182
return false, fmt.Errorf("Invalid regex: %s", err)
182183
}
183-
184-
templateField := templateJSON[m["name"].(string)].(string)
184+
updatedName := strings.ReplaceAll(m["name"].(string), "_", "")
185+
templateField := templateJSON[updatedName].(string)
185186
if !r.MatchString(templateField) {
186187
return false, nil
187188
}

0 commit comments

Comments
 (0)