esc icon indicating copy to clipboard operation
esc copied to clipboard

Add comments to pulumi ESC configs

Open antspy opened this issue 9 months ago • 2 comments

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

It would be nice if we could add comments to the pulumi esc configs & secrets. This helps with understanding why tokens are there, and allows for better code documentation.

antspy avatar Mar 09 '25 09:03 antspy

hey @antspy I could be misunderstanding the ask here - comments are supported today in an ESC environment via #:

# values is a required top-level key
values:
  example: # this is an example
    setting: changeme
  example2:
    setting: ${example.setting}

If you mean comments on the ESC environments themselves in Pulumi Cloud, right now there are revision tags and environment tags which can be used as a comment mechanism.

If none of these fit your proposed use case, would you provide a quick code/config example of what you're thinking?

smithrobs avatar Mar 09 '25 10:03 smithrobs

Hi,

Thank you! I meant comments which are available from the esc command line. Something like:

Image

So next to value, there would be another column comment or doc or whatever. This is returned by the pulumi esc. This would be useful because I query the pulumi environments and create a bunch of files like:

@dataclasses.dataclass 
class MyEnv:
  @property 
  def PUBLIC_ATEST():
    return "..." 

If the esc cli would return the comment, I could add it as docstring to the PUBLIC_ATEST property. The docstring would then be available to be displayed in VSCode as you hover on it.

Similarly, would be cool if we could also add custom attributes to the env variables (also returned by the cli), so they would allow to customize the way the code uses them (e.g. right now I hardcode variables starting with PUBLIC in the generated files, but you might have instead an attribute which determines whether the values should be hardcoded in the generated file, or instead looked up at runtime (for secret api keys, etc.)).

antspy avatar Mar 09 '25 11:03 antspy