Skip to content

Commit

Permalink
fix: pgbouncer to handle settings = []
Browse files Browse the repository at this point in the history
  • Loading branch information
wai-wong-edb committed Aug 1, 2024
1 parent c6f22bc commit b0e6ab7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/plan_modifier/pg_bouncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ func (m CustomPgBouncerModifier) PlanModifyObject(ctx context.Context, req planm
return
}

if !reqPlanIsEnabled.ValueBool() && !reqPlanSettings.IsUnknown() && len(reqPlanSettings.Elements()) == 0 {
resp.Diagnostics.AddError("if pg_bouncer.is_enabled = false then pg_bouncer.settings cannot be []", "please remove pg_bouncer.settings or set pg_bouncer.settings = null")

return
}

// if is_enabled = false and settings is null and state setting is null then use state value for unknown
if !reqPlanIsEnabled.ValueBool() &&
req.ConfigValue.Attributes()["settings"].(basetypes.SetValue).IsNull() &&
Expand Down

0 comments on commit b0e6ab7

Please sign in to comment.