// EnsureInstance returns the state for the instance with the given key,
// creating a new empty state for it if one doesn't already exist.
//
// Because this may create and save a new state, it is considered to be
// a write operation.
EnsureInstance returns the state for the instance with the given key,
creating a new empty state for it if one doesn't already exist.

Because this may create and save a new state, it is considered to be
a write operation.
// EnsureInstance returns the state for the instance with the given key // creating a new empty state for it if one doesn ' t already exist . // // Because this may create and save a new state it is considered to be // a write operation .
func (rs *Resource) EnsureInstance(key addrs.InstanceKey) *ResourceInstance {
	ret := rs.Instance(key)
	if ret == nil {
		ret = NewResourceInstance()
		rs.Instances[key] = ret
	}
	return ret
}
func ( rs * Resource ) EnsureInstance ( key addrs . InstanceKey ) * ResourceInstance { ret := rs . Instance ( key ) if ret == nil { ret = NewResourceInstance ( ) rs . Instances [ key ] = ret } return ret }
EnsureInstance returns the state for the instance with the given key,
creating a new empty state for it if one doesn't already exist.
EnsureInstance returns the state for the instance with the given key creating a new empty state for it if one doesn ' t already exist .