Skip to content

PostgreSQL: model the new flavor field (upstream cozystack#4587) #63

Open

Description

@mattia-eleuteri

cozystack/cozystack#4587 adds a top-level flavor enum to packages/apps/postgres/values.schema.json:

flavor: postgresql   # enum: postgresql | postgis, default postgresql

postgis bootstraps the cluster from the CloudNativePG PostGIS image. The provider does not model the field, so a cozystack_postgres resource cannot create a PostGIS cluster.

Two things to get right. The flavor is fixed at creation: the chart refuses to render a flavor change on an existing cluster, so an update surfaces as a failed HelmRelease rather than a silent image swap. Do not mark it RequiresReplace, which would turn a typo into a destroyed database; let the chart refuse the change. And do not restate the default with stringdefault.StaticString("postgresql"): a provider that sends postgresql on every plan would try to flip a PostGIS cluster created outside Terraform and hit that refusal on every apply. Model it Optional+Computed with UseStateForUnknown and a stringvalidator.OneOf("postgresql", "postgis"), and only send it when the user set it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions