Skip to content

Commit 8f0b6aa

Browse files
committed
Use ResourceDeferred() and DataSourceDeferred() functions in toproto6 package
1 parent 038d486 commit 8f0b6aa

File tree

4 files changed

+4
-24
lines changed

4 files changed

+4
-24
lines changed

internal/toproto6/importresourcestate.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func ImportResourceStateResponse(ctx context.Context, fw *fwserver.ImportResourc
1919
}
2020

2121
proto6 := &tfprotov6.ImportResourceStateResponse{
22+
Deferred: ResourceDeferred(fw.Deferred),
2223
Diagnostics: Diagnostics(ctx, fw.Diagnostics),
2324
}
2425

@@ -34,11 +35,5 @@ func ImportResourceStateResponse(ctx context.Context, fw *fwserver.ImportResourc
3435
proto6.ImportedResources = append(proto6.ImportedResources, proto6ImportedResource)
3536
}
3637

37-
if fw.Deferred != nil {
38-
proto6.Deferred = &tfprotov6.Deferred{
39-
Reason: tfprotov6.DeferredReason(fw.Deferred.Reason),
40-
}
41-
}
42-
4338
return proto6
4439
}

internal/toproto6/planresourcechange.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func PlanResourceChangeResponse(ctx context.Context, fw *fwserver.PlanResourceCh
2020
}
2121

2222
proto6 := &tfprotov6.PlanResourceChangeResponse{
23+
Deferred: ResourceDeferred(fw.Deferred),
2324
Diagnostics: Diagnostics(ctx, fw.Diagnostics),
2425
}
2526

@@ -38,11 +39,5 @@ func PlanResourceChangeResponse(ctx context.Context, fw *fwserver.PlanResourceCh
3839
proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...)
3940
proto6.PlannedPrivate = plannedPrivate
4041

41-
if fw.Deferred != nil {
42-
proto6.Deferred = &tfprotov6.Deferred{
43-
Reason: tfprotov6.DeferredReason(fw.Deferred.Reason),
44-
}
45-
}
46-
4742
return proto6
4843
}

internal/toproto6/readdatasource.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func ReadDataSourceResponse(ctx context.Context, fw *fwserver.ReadDataSourceResp
1919
}
2020

2121
proto6 := &tfprotov6.ReadDataSourceResponse{
22+
Deferred: DataSourceDeferred(fw.Deferred),
2223
Diagnostics: Diagnostics(ctx, fw.Diagnostics),
2324
}
2425

@@ -27,11 +28,5 @@ func ReadDataSourceResponse(ctx context.Context, fw *fwserver.ReadDataSourceResp
2728
proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...)
2829
proto6.State = state
2930

30-
if fw.Deferred != nil {
31-
proto6.Deferred = &tfprotov6.Deferred{
32-
Reason: tfprotov6.DeferredReason(fw.Deferred.Reason),
33-
}
34-
}
35-
3631
return proto6
3732
}

internal/toproto6/readresource.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func ReadResourceResponse(ctx context.Context, fw *fwserver.ReadResourceResponse
1919
}
2020

2121
proto6 := &tfprotov6.ReadResourceResponse{
22+
Deferred: ResourceDeferred(fw.Deferred),
2223
Diagnostics: Diagnostics(ctx, fw.Diagnostics),
2324
}
2425

@@ -32,11 +33,5 @@ func ReadResourceResponse(ctx context.Context, fw *fwserver.ReadResourceResponse
3233
proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...)
3334
proto6.Private = newPrivate
3435

35-
if fw.Deferred != nil {
36-
proto6.Deferred = &tfprotov6.Deferred{
37-
Reason: tfprotov6.DeferredReason(fw.Deferred.Reason),
38-
}
39-
}
40-
4136
return proto6
4237
}

0 commit comments

Comments
 (0)