Skip to content

Commit 6f85388

Browse files
committed
Deprecate GetOkExists and clarify docs
1 parent dbee9ba commit 6f85388

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

helper/schema/resource_data.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,11 @@ func (d *ResourceData) GetOk(key string) (interface{}, bool) {
108108
return r.Value, exists
109109
}
110110

111-
// GetOkExists returns the data for a given key and whether or not the key
112-
// has been set to a non-zero value. This is only useful for determining
113-
// if boolean attributes have been set, if they are Optional but do not
114-
// have a Default value.
111+
// GetOkExists can check if TypeBool attributes that are Optional with
112+
// no Default value have been set.
115113
//
116-
// This is nearly the same function as GetOk, yet it does not check
117-
// for the zero value of the attribute's type. This allows for attributes
118-
// without a default, to fully check for a literal assignment, regardless
119-
// of the zero-value for that type.
120-
// This should only be used if absolutely required/needed.
114+
// Deprecated: usage is discouraged due to undefined behaviors and may be
115+
// removed in a future version of the SDK
121116
func (d *ResourceData) GetOkExists(key string) (interface{}, bool) {
122117
r := d.getRaw(key, getSourceSet)
123118
exists := r.Exists && !r.Computed

0 commit comments

Comments
 (0)