Skip to content

Add Support for crossplane.io/external-name in provider-sql to Handle Reserved Characters (e.g., Hyphens) #261

@sandpwr

Description

@sandpwr

The provider-sql currently does not support the crossplane.io/external-name annotation for managed resources like Databases and Roles. This is a commonly used pattern in other Crossplane providers to allow logical names in configuration to differ from physical resource names especially important when integrating with existing systems or naming constraints.
Additionally, provider-sql currently supports creation of objects with hyphens (-) in their names, such as:

metadata:
  name: postgresql-role-with-hyphen

However, hyphens are not valid unquoted identifiers in PostgreSQL (they are interpreted as subtraction operators). This can cause runtime errors or require manual quoting of names in SQL, which is error-prone and hard to manage.

Request:

  • Add support for metadata.annotations.crossplane.io/external-name so users can explicitly define the physical name to be used in the target SQL database.
  • This would allow:
    • Importing existing resources with incompatible or legacy names.
    • Overriding default generated names.
    • Handling reserved or invalid characters (like hyphens) cleanly.
  • Ensure that physical names are safely quoted in SQL if they contain special characters (like -), or advise explicitly on quoting strategy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions