Skip to content

Conversation

tanmay-db
Copy link
Contributor

@tanmay-db tanmay-db commented Aug 22, 2025

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

  • Tests panics before the changes (ref):
image - Tests passes over the changes

@tanmay-db tanmay-db requested review from a team as code owners August 22, 2025 14:14
@tanmay-db tanmay-db requested review from renaudhartert-db and removed request for a team August 22, 2025 14:14
@tanmay-db tanmay-db removed request for a team and renaudhartert-db August 22, 2025 14:15
@tanmay-db tanmay-db changed the title [Fix] Fix syncing effective fields in share resource [Fix] Fixed syncing of effective fields in plugin framework implementation of share resource Aug 22, 2025
for j := range planObjects {
if stateObjects[i].Name == planObjects[j].Name {
mode.objectLevel(ctx, &stateObjects[i], planObjects[j])
finalObjects = append(finalObjects, stateObjects[i])
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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)
Copy link
Contributor

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?

@rauchy rauchy force-pushed the panic-share-pluginfw branch from 006c174 to 881c81c Compare August 28, 2025 11:02
@rauchy rauchy temporarily deployed to test-trigger-is August 28, 2025 11:02 — with GitHub Actions Inactive
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/terraform

Inputs:

  • PR number: 4969
  • Commit SHA: 881c81c7dcc21d8af31591a6385fc22b81d57749

Checks will be approved automatically on success.

@rauchy rauchy temporarily deployed to test-trigger-is August 28, 2025 11:03 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants