Skip to content

Commit 04fb266

Browse files
authored
tfprotov5+tfprotov6: Additional Go documentation for private state handling (#193)
Reference: #192
1 parent d1b8fb8 commit 04fb266

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

tfprotov5/resource.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ type ReadResourceRequest struct {
128128
// Private is any provider-defined private state stored with the
129129
// resource. It is used for keeping state with the resource that is not
130130
// meant to be included when calculating diffs.
131+
//
132+
// To ensure private state data is preserved, copy any necessary data to
133+
// the ReadResourceResponse type Private field.
131134
Private []byte
132135

133136
// ProviderMeta supplies the provider metadata configuration for the
@@ -215,6 +218,9 @@ type PlanResourceChangeRequest struct {
215218
// PriorPrivate is any provider-defined private state stored with the
216219
// resource. It is used for keeping state with the resource that is not
217220
// meant to be included when calculating diffs.
221+
//
222+
// To ensure private state data is preserved, copy any necessary data to
223+
// the PlanResourceChangeResponse type PlannedPrivate field.
218224
PriorPrivate []byte
219225

220226
// ProviderMeta supplies the provider metadata configuration for the
@@ -283,6 +289,10 @@ type PlanResourceChangeResponse struct {
283289
// like sent with requests for this resource. This state will be
284290
// associated with the resource, but will not be considered when
285291
// calculating diffs.
292+
//
293+
// This private state data will be sent in the ApplyResourceChange RPC, in
294+
// relation to the types of this package, the ApplyResourceChangeRequest
295+
// type PlannedPrivate field.
286296
PlannedPrivate []byte
287297

288298
// Diagnostics report errors or warnings related to determining the
@@ -344,6 +354,13 @@ type ApplyResourceChangeRequest struct {
344354
// PlannedPrivate is any provider-defined private state stored with the
345355
// resource. It is used for keeping state with the resource that is not
346356
// meant to be included when calculating diffs.
357+
//
358+
// This private state data is sourced from the PlanResourceChange RPC, in
359+
// relation to the types in this package, the PlanResourceChangeResponse
360+
// type PlannedPrivate field.
361+
//
362+
// To ensure private state data is preserved, copy any necessary data to
363+
// the ApplyResourceChangeResponse type Private field.
347364
PlannedPrivate []byte
348365

349366
// ProviderMeta supplies the provider metadata configuration for the

tfprotov6/resource.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ type ReadResourceRequest struct {
125125
// Private is any provider-defined private state stored with the
126126
// resource. It is used for keeping state with the resource that is not
127127
// meant to be included when calculating diffs.
128+
//
129+
// To ensure private state data is preserved, copy any necessary data to
130+
// the ReadResourceResponse type Private field.
128131
Private []byte
129132

130133
// ProviderMeta supplies the provider metadata configuration for the
@@ -212,6 +215,9 @@ type PlanResourceChangeRequest struct {
212215
// PriorPrivate is any provider-defined private state stored with the
213216
// resource. It is used for keeping state with the resource that is not
214217
// meant to be included when calculating diffs.
218+
//
219+
// To ensure private state data is preserved, copy any necessary data to
220+
// the PlanResourceChangeResponse type PlannedPrivate field.
215221
PriorPrivate []byte
216222

217223
// ProviderMeta supplies the provider metadata configuration for the
@@ -280,6 +286,10 @@ type PlanResourceChangeResponse struct {
280286
// like sent with requests for this resource. This state will be
281287
// associated with the resource, but will not be considered when
282288
// calculating diffs.
289+
//
290+
// This private state data will be sent in the ApplyResourceChange RPC, in
291+
// relation to the types of this package, the ApplyResourceChangeRequest
292+
// type PlannedPrivate field.
283293
PlannedPrivate []byte
284294

285295
// Diagnostics report errors or warnings related to determining the
@@ -341,6 +351,13 @@ type ApplyResourceChangeRequest struct {
341351
// PlannedPrivate is any provider-defined private state stored with the
342352
// resource. It is used for keeping state with the resource that is not
343353
// meant to be included when calculating diffs.
354+
//
355+
// This private state data is sourced from the PlanResourceChange RPC, in
356+
// relation to the types in this package, the PlanResourceChangeResponse
357+
// type PlannedPrivate field.
358+
//
359+
// To ensure private state data is preserved, copy any necessary data to
360+
// the ApplyResourceChangeResponse type Private field.
344361
PlannedPrivate []byte
345362

346363
// ProviderMeta supplies the provider metadata configuration for the

0 commit comments

Comments
 (0)