Getting error on setting boolean attribute inside a map

I have a schema definition like this

		"attribute_map": {
				Type:        schema.TypeMap,
				Computed:    true,
				Description: "map of attributes",
			},

and its implementation contains this code :

		map := map[string]interface{}{
			"flag": attMap.Flag,
		}
		d.Set("attribute_map", map)

Getting this error :

[ERROR] setting state: attribute_map.flag: '' expected type 'string', got unconvertible type 'bool', value: '0xc001734c17'

@jbardin @apparentlymart

Is this expected that map will only have string value pair ?

@ramuklawjju,

That looks like part of an SDKv2 schema, with no element type for the map. Since a map must have a defined type, IIRC the legacy SDK would default to a string.

2 Likes