Workaround attempt for perpetual diff in lambda with vpc_config #16124
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Community Note
Relates #15952
Release note for CHANGELOG:
WIP: Attempt at a workaround for perpetual plan on
aws_lambda_function
withvpc_config
. #15952 is labeled "good first issue", so I tried.I tracked the cause to
d.HasChange("vpc_config")
returningtrue
even ifvpc_config
did not actually change (two results fromGetChange
are identical as confirmed byreflect.DeepEqual
).I'm not very familiar with either this provider's internals or mechanics of Terraform plugins in general. This might be a bug in terraform-plugin-sdk (search for HasChange in the SDK repo returns some open issues, but they seem to refer to v1 of the SDK) or some subtle issue in the provider itself. Falling back on reflection to compare values seems to be code smell, but this fixes the issue for me and might provide some hints for a real fix.
I haven't figured out how to update tests yet, I'll try to add a test case later. Publishing a draft in the meantime to gather feedback (or help maintainers with finding a proper fix).
TODO: Output from acceptance testing: