Skip to content

Commit

Permalink
Fix change detection relating to vpc_config
Browse files Browse the repository at this point in the history
As reported in #17385
a change i  detected in vpc_config when there are no changes, this is
caused by an issue in hashicorp/terraform-plugin-sdk#617
The PR to provide a fix is not getting any traction.

On further debuging the issue is caused by the nested elements being of
type set which needs the use of Equal rather than reflect.DeepEqual to
test for differences.

We can work around this bug by testing for changes in the two fields
within vpc_config independantly as when the item passed to HasChanges is
a Set it is tested correctly.
  • Loading branch information
grahamhar committed Mar 27, 2021
1 parent d0fb8dd commit 82ff95d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aws/resource_aws_lambda_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ func hasConfigChanges(d resourceDiffer) bool {
d.HasChange("layers") ||
d.HasChange("dead_letter_config") ||
d.HasChange("tracing_config") ||
d.HasChange("vpc_config") ||
d.HasChange("vpc_config.0.security_group_ids") ||
d.HasChange("vpc_config.0.subnet_ids") ||
d.HasChange("runtime") ||
d.HasChange("environment")
}
Expand Down

0 comments on commit 82ff95d

Please sign in to comment.