-
Notifications
You must be signed in to change notification settings - Fork 451
[Fix] Fixed syncing of effective fields in plugin framework implementation of share resource #4969
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
base: main
Are you sure you want to change the base?
Conversation
for j := range planObjects { | ||
if stateObjects[i].Name == planObjects[j].Name { | ||
mode.objectLevel(ctx, &stateObjects[i], planObjects[j]) | ||
finalObjects = append(finalObjects, stateObjects[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if the plan as an object which is not in the state? It seems that we are ignoring it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we ignore it because in terraform we want to create the infra from the config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain a bit more what is what? I think I am mixing what stateObjects, planObjects and finalObjects are.
As it is, it feels that we are storing (state) a different set of objects that we are creating (plan).
@@ -446,8 +446,13 @@ func (r *ShareResource) syncEffectiveFields(ctx context.Context, plan, state Sha | |||
stateObjects, _ := state.GetObjects(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we suppressing the error? Can this fail?
006c174
to
881c81c
Compare
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Changes
Planned objects can be less than the state objects. This can happen when someone removes an object in share resource outside the terraform (for example through UI). The changes fixes the syncing of effective fields by making sure we iterate over the planned and state objects properly.
Ref: #4913
Tests
Unit tests