Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: prefix output #126

Open
Gowiem opened this issue Apr 6, 2021 · 3 comments
Open

Proposal: prefix output #126

Gowiem opened this issue Apr 6, 2021 · 3 comments

Comments

@Gowiem
Copy link
Member

Gowiem commented Apr 6, 2021

Describe the Feature

I find it common that folks will utilize what I think of as the label's prefix (e.g. ${namespace}-${stage}-${environment}) as a string interpolation prefix to some identifier that they want to create without building a full label.

Most of the time this is used as a crutch to avoid having to create a label module for each namable thing that you're working on. It could definitely be argued that this is a bad practice and that it shouldn't be done... but I've seen it enough now across multiple codebases that I know I'm not the only one who does it so figured this proposal was worth the discussion.

The proposal is to add a new output called prefix that is simply all label components up until the name component. e.g. ${namespace}-${stage}-${environment}, ${namespace}-${stage}, ${namespace}-${environment}, etc.

I would need to look into the code more to determine how we would handle that in regards to the label ordering... but figured I could bring this up for discussion before coming up with a proper solution.

Use Case

This would enable not having to create this label prefix for ad-hoc usages and therefore dry up some terraform string interpolation code.

Alternatives Considered

Alternatives:

  1. Don't do this... I'd be fine to hear the feedback here say something along the lines of: Hey that should be considered bad practice and we don't want to support it.
  2. Create a prefix label that is only made up of the components that you want instead of outputting the prefix from more specific labels.
@Jamie-BitFlight
Copy link
Contributor

Jamie-BitFlight commented Apr 6, 2021 via email

@Gowiem
Copy link
Member Author

Gowiem commented Apr 6, 2021

@Jamie-BitFlight yeah I get that POV and after getting the thoughts from the wider Cloud Posse team on this I'm going to close out.

@Gowiem Gowiem closed this as completed Apr 6, 2021
@Gowiem
Copy link
Member Author

Gowiem commented Feb 22, 2024

I'm going to reopen this for discussion... I still see it being done and I honestly this it has merit. I'm not sure if this is just me being bull headed and misremember my conversation with the community, but I want this to be discussed here in this issue before calling it closed as I'm coming back this issue years later and still wanting this functionality

@Gowiem Gowiem reopened this Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants