terraform-azurerm-caf icon indicating copy to clipboard operation
terraform-azurerm-caf copied to clipboard

Feature request- name passthrough support for individual resources

Open najeebvv opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Most of the resources in caf have name generated via azurecaf_name. However in some cases, we are looking for names which are predictable or configurable. caf currently support this feature on a landingzone level and it would be useful to support this on individual resource level too.

One such use case is azurerm_servicebus_topic where we are looking for a predictable name. Such names might also be useful in scenarios where user imports existing terraform resources into caf.

I would like to propose passthrough setting inside a resource settings, so that resource could support custom names where needed. and this also avoids breaking change in resource names.

resource "azurecaf_name" "topic" { name = var.settings.name resource_type = "azurerm_servicebus_topic" prefixes = var.global_settings.prefixes random_length = var.global_settings.random_length clean_input = true passthrough = try(var.settings.passthough, false) ? var.settings.passthough : var.global_settings.passthrough use_slug = var.global_settings.use_slug }

New or Affected Resource(s

azurerm_servicebus_topic

Potential Configuration file

servicebus_topics = {
  topic1 = {
    servicebus_namespace = {
      key = "default"
    }
    name                                    = "random-name"
    passthough                              = true
    default_message_ttl                     = "P14D"
    max_size_in_megabytes                   = 1024
    requires_duplicate_detection            = false
    duplicate_detection_history_time_window = "PT10M"
    enable_batched_operations               = true
    status                                  = "Active"
    support_ordering                        = true
    auto_delete_on_idle                     = "P10675199DT2H48M5.4775807S"
    enable_partitioning                     = false
    enable_express                          = false

    subscriptions = {
      sub1 = {
        name                                      = "random-name"
        lock_duration                             = "PT1M"
        max_delivery_count                        = 10
        requires_session                          = false
        default_message_ttl                       = "P14D"
        dead_lettering_on_message_expiration      = false
        dead_lettering_on_filter_evaluation_error = false
        enable_batched_operations                 = true
        auto_delete_on_idle                       = "P10675198DT2H48M5S"
        status                                    = "Active"

        subscription_rules = {
          sql_filter_rules = {
            default = {
              name       = "$Default"
              sql_filter = "1=1"
            }
          }
        }
      }
    }
  }
}

References

No response

najeebvv avatar Feb 02 '24 14:02 najeebvv