Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the ID string to empty string on Terraform state for calculating the diffs #337

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/controller/external_nofork.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ func (n *noForkExternal) Observe(ctx context.Context, mg xpresource.Managed) (ma
if diag != nil && diag.HasError() {
return managed.ExternalObservation{}, errors.Errorf("failed to observe the resource: %v", diag)
}
n.opTracker.SetTfState(newState) // TODO: missing RawConfig & RawPlan here...
diffState := n.opTracker.GetTfState()
n.opTracker.SetTfState(newState) // TODO: missing RawConfig & RawPlan here...
resourceExists := newState != nil && newState.ID != ""

var stateValueMap map[string]any
Expand All @@ -492,6 +492,7 @@ func (n *noForkExternal) Observe(ctx context.Context, mg xpresource.Managed) (ma
diffState = newState
} else if diffState != nil {
diffState.Attributes = nil
diffState.ID = ""
}
instanceDiff, err := n.getResourceDataDiff(mg.(resource.Terraformed), ctx, diffState, resourceExists)
if err != nil {
Expand Down
Loading