Skip to content

Commit

Permalink
ignore non-effective diff for LBTargetGroup unhealthy_draining_interv…
Browse files Browse the repository at this point in the history
…al defaulting

Signed-off-by: Erhan Cagirici <[email protected]>
  • Loading branch information
erhancagirici committed Oct 20, 2024
1 parent 0585e02 commit eeb6c4b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config/elbv2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ func Configure(p *config.Provider) { //nolint:gocyclo
s.Computed = false
}
r.LateInitializer.IgnoredFields = []string{"target_failover"}
r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
// skip no diff or destroy diffs
if diff == nil || diff.Empty() || diff.Destroy || diff.Attributes == nil {
return diff, nil
}

// ignore diff due to defaulting in the TF schema
udiDiff, ok := diff.Attributes["target_health_state.0.unhealthy_draining_interval"]
if ok && udiDiff.Old == "" && udiDiff.New == "0" {
delete(diff.Attributes, "target_health_state.0.unhealthy_draining_interval")
}
return diff, nil
}
})

p.AddResourceConfigurator("aws_lb_target_group_attachment", func(r *config.Resource) {
Expand Down

0 comments on commit eeb6c4b

Please sign in to comment.