diff --git a/helper/plugin/grpc_provider.go b/helper/plugin/grpc_provider.go index c668e9733..53809e273 100644 --- a/helper/plugin/grpc_provider.go +++ b/helper/plugin/grpc_provider.go @@ -847,7 +847,7 @@ func pathToAttributePath(path cty.Path) *proto.AttributePath { // normalizeFlatmapContainers removes empty containers, and fixes counts in a // set of flatmapped attributes. func normalizeFlatmapContainers(attrs map[string]string) map[string]string { - keyRx := regexp.MustCompile(`.*\.[%#]$`) + keyRx := regexp.MustCompile(`.\.[%#]$`) // find container keys var keys []string diff --git a/helper/plugin/grpc_provider_test.go b/helper/plugin/grpc_provider_test.go index a06185fc4..5dd33ac2b 100644 --- a/helper/plugin/grpc_provider_test.go +++ b/helper/plugin/grpc_provider_test.go @@ -661,6 +661,10 @@ func TestNormalizeFlatmapContainers(t *testing.T) { attrs: map[string]string{"multi.529860700.set.#": "1", "multi.#": "1", "id": "78629a0f5f3f164f"}, expect: map[string]string{"id": "78629a0f5f3f164f"}, }, + { + attrs: map[string]string{"set.2.required": "bar", "set.2.list.#": "1", "set.2.list.0": "x", "set.1.list.#": "0"}, + expect: map[string]string{"set.2.list.#": "1", "set.2.list.0": "x", "set.2.required": "bar", "set.#": "1"}, + }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { got := normalizeFlatmapContainers(tc.attrs)