Skip to content

Support named constants, or imports? #1067

@bencmaps

Description

@bencmaps

Category

Cedar language or syntax features/changes

Describe the feature you'd like to request

I have some Cedar policy files with multiple permit statements referring to the same principal condition, eg. principal in AWS::IDC::Group::"<some uuid>" // the xyz team. They're separated into multiple statements in order to provide more fine-grained @advice comments as well as sometimes to add extra conditions.

I'm wondering what the recommendation is for minimizing duplication of this group ID. It seems like it would be nice to be able to define a named binding somewhere, either in the same file or a standalone file, that could then be referred to by name in all these reference points, so the actual ID only need be spelled out once.

Describe alternatives you've considered

  • Status quo: just duplicate the raw IDs everywhere they're needed.
  • Introduce some preprocessing step to find-and-replace words like @@@XYZ_GROUP@@@ with their value, but this introduces extra moving pieces/state that is undesirable.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestThis issue requets a substantial new featurerequires-RFCThis issue requests a substanial change to the Cedar langauge which needs to follow the RFC process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions