Skip to content

Don't enforce unchangeable naming conventions on the budget name #25

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

Open
Y0RI0 opened this issue Aug 24, 2023 · 1 comment · May be fixed by #58
Open

Don't enforce unchangeable naming conventions on the budget name #25

Y0RI0 opened this issue Aug 24, 2023 · 1 comment · May be fixed by #58
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Y0RI0
Copy link

Y0RI0 commented Aug 24, 2023

Describe the Feature

Don't enforce unchangeable naming conventions on the budget name. It limits the flexibility of the original resource's definition and it may not work with pre-existing budgets in many organizations if it's needed to import those into state using this module.

name              = format("%s-%s", module.this.id, each.value.name)

Expected Behavior

The expectation would be that there would be a completely open input for name that wouldn't force a name"-"name naming scheme.

Use Case

Let's say I have a bunch of pre-existing budgets in an org. They've all got some specific naming scheme but they weren't originally created with terraform. I want to import them into state, but I can't do that when this module doesn't allow budgets to have a name outside of the name"-"name format.

Describe Ideal Solution

The ideal solution to this would just to have the name piece be an input string, but I can understand that since you can define multiple alerts under a single module definition, the reason it is written this way is so that each sub-alert with be separated with that naming convention "-".

name              = format("%s-%s", module.this.id, each.value.name)
  name = "test"

  budgets = [
    {
      name            = "example"

      budget_type     = "COST"
      limit_amount    = "5000"
      limit_unit      = "USD"
      // time_period_end = "2087-06-15_00:00"
      time_unit       = "MONTHLY"

      cost_filter = { }

As it stands right now, I'll get a budget called 'test-example`

But if I want a budget just called example I can't have that by leaving out name = "test" , what will instead happen is I'll get a budget called -example like so

  # aws_budgets_budget.default["0"] will be created
  + resource "aws_budgets_budget" "default" {
      + name              = "-example"

If you want to maintain all of the logic being the same you could just remove the "-" so that if I choose not to specify the first name I am not left with a hanging dash on my actual budget name like so:

name              = format("%s%s", module.this.id, each.value.name)

And this would product the desired effect.

  # aws_budgets_budget.default["0"] will be created
  + resource "aws_budgets_budget" "default" {
      + name              = "example"

Alternatives Considered

No response

Additional Context

No response

@Gowiem Gowiem added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jan 22, 2025
@Gowiem
Copy link
Member

Gowiem commented Jan 22, 2025

This seems reasonable and could be implemented through adding a new variable like naming_prefix_enabled which defaults to true.

@sschwebler sschwebler linked a pull request May 7, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants