When I create a new attribute:
"foo": {
Type: schema.TypeMap,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Sensitive: true,
Required: true,
ForceNew: false,
},
everything works as expected. However when I add a new property to it:
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return true
},
to ignore every change between state and main.tf (foo property is only being used on CREATE) d.Get("foo") starts returning an empty map which is super confusing. As soon as I remove DiffSuppressFunc d.Get("foo") is not an empty map anymore (as expected).
https://github.com/hashicorp/terraform-plugin-sdk/issues/477 seems to be related.
Update: the issue seems to be the fact that DiffSuppressFunc is being called with
"foo.%" "0" "2"
even before d.Get().