Skip to content

Commit

Permalink
Merge pull request #337 from ulucinar/fix-settagdiff-panic
Browse files Browse the repository at this point in the history
Set the ID string to empty string on Terraform state for calculating the diffs
  • Loading branch information
ulucinar authored Jan 31, 2024
2 parents 0e52e5d + cfc0349 commit 3c2fda9
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit 3c2fda9

Please sign in to comment.