Filtering data sources by tags does not work — no resources are ever returned when a tags filter is specified.
Important note: The tag filtering for data sources was not documented/tested as a feature for any data source, until recently when I added it to the volume data source, when I noticed that, the underlying schema accepts it.
Root cause: gatherXxxResourceData stores tags as cloudscale.TagMap (map[string]string), but d.GetOk("tags") returns map[string]interface{}. When compared via != as interface{} values, Go sees two different dynamic types and the comparison is always true (not equal), so no resource ever matches.
Research / Decision needed: Should tag filtering use subset semantics (resource contains at least the specified tags) or exact match (resource tags must be identical to the filter)? I am not sure, what the expected behavior was, right now.
Filtering data sources by tags does not work — no resources are ever returned when a
tagsfilter is specified.Important note: The tag filtering for data sources was not documented/tested as a feature for any data source, until recently when I added it to the volume
data source, when I noticed that, the underlying schema accepts it.Root cause:
gatherXxxResourceDatastores tags ascloudscale.TagMap(map[string]string), butd.GetOk("tags")returnsmap[string]interface{}. When compared via!=asinterface{}values, Go sees two different dynamic types and the comparison is alwaystrue(not equal), so no resource ever matches.Research / Decision needed: Should tag filtering use subset semantics (resource contains at least the specified tags) or exact match (resource tags must be identical to the filter)? I am not sure, what the expected behavior was, right now.