Skip to content

Commit

Permalink
Merge pull request #598 from SumoLogic/zzhou-dashboard-metadata-varia…
Browse files Browse the repository at this point in the history
…ble-filter-default

SUMO-231823: Default dashboard metadata variable filter value
  • Loading branch information
sumo-zzhou authored Jan 22, 2024
2 parents d620fe6 + 9168f84 commit 58016cd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sumologic/resource_sumologic_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,8 @@ func getVariable(tfVariable map[string]interface{}) Variable {
}

func getSourceDefinition(tfSourceDef map[string]interface{}) interface{} {
const defaultFilterValue = ""

if val := tfSourceDef["log_query_variable_source_definition"].([]interface{}); len(val) == 1 {
logQuerySourceDef := val[0].(map[string]interface{})
return LogQueryVariableSourceDefinition{
Expand All @@ -842,9 +844,13 @@ func getSourceDefinition(tfSourceDef map[string]interface{}) interface{} {
}
} else if val := tfSourceDef["metadata_variable_source_definition"].([]interface{}); len(val) == 1 {
metadataSourceDef := val[0].(map[string]interface{})
filter, hasFilter := metadataSourceDef["filter"].(string)
if !hasFilter {
filter = defaultFilterValue
}
return MetadataVariableSourceDefinition{
VariableSourceType: "MetadataVariableSourceDefinition",
Filter: metadataSourceDef["filter"].(string),
Filter: filter,
Key: metadataSourceDef["key"].(string),
}
} else if val := tfSourceDef["csv_variable_source_definition"].([]interface{}); len(val) == 1 {
Expand Down

0 comments on commit 58016cd

Please sign in to comment.