I’m reaching out regarding this issue: schema.TypeSet: optional primitive(TypeInt/TypeBool) schema attributes: drift (null -> default) after initial apply · Issue #784 · hashicorp/terraform-plugin-sdk · GitHub
From my understanding this is a common issue (plugin cannot differentiate between default vs. unset/null attributes in state) in Terraform plugin SDK but I couldn’t understand if any fix is available yet?
Currently this is impacting our customer as we have some TypeInt attributes in our schema which are getting defaulted to 0 in the state file. These are Optional attributes , hence we expect these to be null.
- I have tried having
Default: nil
for these as well but it still didn’t work and attributes are always saved as 0 in state file. - Fyi concerned attributes are nested in a List of Objects, so I was unable to do a
d.Set()
on individual attributes as well.
However, since the plugin always sets these to 0, this causes issues as during the next ‘terraform apply’, these attributes are set to 0 in Atlas causing unexpected behaviors.Please confirm if this is an existing issue and advise any workarounds for the same.
Please let me know if I can provide any additional information/examples to help