From a6a81ed3fd5640e8d1d86093b8ba16cbdbbc0970 Mon Sep 17 00:00:00 2001 From: damans227 Date: Sat, 6 Aug 2022 18:17:55 -0400 Subject: [PATCH] fix for using display_text as a filter in template datasource --- cloudstack/data_source_cloudstack_template.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cloudstack/data_source_cloudstack_template.go b/cloudstack/data_source_cloudstack_template.go index ba4689ce..0025f64b 100644 --- a/cloudstack/data_source_cloudstack_template.go +++ b/cloudstack/data_source_cloudstack_template.go @@ -24,6 +24,7 @@ import ( "fmt" "log" "regexp" + "strings" "time" "github.com/apache/cloudstack-go/v2/cloudstack" @@ -180,8 +181,8 @@ func applyFilters(template *cloudstack.Template, filters *schema.Set) (bool, err if err != nil { return false, fmt.Errorf("Invalid regex: %s", err) } - - templateField := templateJSON[m["name"].(string)].(string) + updatedName := strings.ReplaceAll(m["name"].(string), "_", "") + templateField := templateJSON[updatedName].(string) if !r.MatchString(templateField) { return false, nil }