Skip to content

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

@Y0RI0

Description

@Y0RI0

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions