Skip to content

Add value.IsNullOrUnknown() function #1060

Open
@zliang-akamai

Description

@zliang-akamai

Does this make sense for checking whether the value has a real value?

I have an optional but non-computed attribute, I usually think I can safely assume the plan will never be an Unknown value but am worried about someone change the schema to computed in the future and this can become a side-effect.

Writing s.IsNull() || s.IsUnknown() is verbose in provider code, IMO.

func (s StringValue) IsNullOrUnknown() bool {
	return s.IsNull() || s.IsUnknown()
}

Kind of like if someAttr, ok := d.GetOk("some_attr"); ok {} in SDKv2

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions