I am using “flag_presence” attribute as TypeBool
"flag_presence": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Indicates whether attribute is present",
},
Now when I am doing this
d.Get(“flag_presence”) gives false
d.GetOk(“flag_presence”) gives false and false
d.GetOkExists(“flag_presence”) gives false and true
My logic is to check if the attribute is present, if present then set it to the options prototype.
if flagPresenceOk, ok := d.GetOkExists("flag_presence"); ok {
flagPresence := flagPresenceOk.(bool)
if flagPresence {
options.FlagPresence = &flagPresence
}
}
GetOkExists works for me for now but I am getting this warning
Deprecated: usage is discouraged due to undefined behaviors and may be
// removed in a future version of the SDK
Please suggest.