Azure / terraform-azurerm-avm-res-servicebus-namespace

https://registry.terraform.io/modules/Azure/avm-res-servicebus-namespace/azurerm
MIT License
1 stars 3 forks source link

Terraform Azure Service Bus Namespace Module

This Terraform module is designed to create Azure Service bus namespaces and its related resources, including queues and topics.

[!WARNING] Major version Zero (0.y.z) is for initial development. Anything MAY change at any time. A module SHOULD NOT be considered stable till at least it is major version one (1.0.0) or greater. Changes will always be via new versions being published and no changes will be made to existing published versions. For more details please go to https://semver.org/

Features

Limitations

Examples

Requirements

The following requirements are needed by this module:

Providers

The following providers are used by this module:

Resources

The following resources are used by this module:

Required Inputs

The following input variables are required:

location

Description: Azure region where the resource should be deployed.
If null, the location will be inferred from the resource group location.
Changing this forces a new resource to be created.

Example Inputs: eastus
See more in CLI: az account list-locations -o table --query "[].name"

Type: string

name

Description: Specifies the name of the ServiceBus Namespace resource.
Changing this forces a new resource to be created.
Name must only contain letters, numbers, and hyphens and be between 6 and 50 characteres long. Also, it must not start or end with a hyphen.

Example Inputs: sb-sharepoint-prod-westus-001
See more: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules#microsoftservicebus

Type: string

resource_group_name

Description: The name of the resource group in which to create this resource.
Changing this forces a new resource to be created.
Name must be less than 90 characters long and must only contain underscores, hyphens, periods, parentheses, letters, or digits.

Example Inputs: rg-sharepoint-prod-westus-001
See more: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules#microsoftresources

Type: string

Optional Inputs

The following input variables are optional (have default values):

authorization_rules

Description: Defaults to {}. Manages a ServiceBus Namespace authorization Rule within a ServiceBus.

Type:

map(object({
    name   = optional(string, null)
    send   = optional(bool, false)
    listen = optional(bool, false)
    manage = optional(bool, false)
  }))

Default: {}

capacity

Description: Always set to 0 for Standard and Basic. Defaults to 1 for Premium. Specifies the capacity.
When sku is Premium, capacity can be 1, 2, 4, 8 or 16.

Type: number

Default: null

customer_managed_key

Description: Defaults to null. Ignored for Basic and Standard. Defines a customer managed key to use for encryption.

Type:

object({
    key_name              = string
    key_vault_resource_id = string

    key_version = optional(string, null)

    user_assigned_identity = optional(object({
      resource_id = string
    }), null)
  })

Default: null

diagnostic_settings

Description: Defaults to {}. A map of diagnostic settings to create. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.

Type:

map(object({
    name                                     = optional(string, null)
    log_categories                           = optional(set(string), [])
    log_groups                               = optional(set(string), ["allLogs"])
    metric_categories                        = optional(set(string), ["AllMetrics"])
    log_analytics_destination_type           = optional(string, "Dedicated")
    workspace_resource_id                    = optional(string, null)
    storage_account_resource_id              = optional(string, null)
    event_hub_authorization_rule_resource_id = optional(string, null)
    event_hub_name                           = optional(string, null)
    marketplace_partner_resource_id          = optional(string, null)
  }))

Default: {}

enable_telemetry

Description: Defaults to true. This variable controls whether or not telemetry is enabled for the module.
For more information see https://aka.ms/avm/telemetryinfo.
If it is set to false, then no telemetry will be collected.

Type: bool

Default: true

infrastructure_encryption_enabled

Description: Defaults to true. Used to specify whether enable Infrastructure Encryption (Double Encryption). Changing this forces a new resource to be created. Requires customer_managed_key.

Type: bool

Default: true

local_auth_enabled

Description: Defaults to true. Whether or not SAS authentication is enabled for the Service Bus namespace.

Type: bool

Default: true

lock

Description: Defaults to null. Controls the Resource Lock configuration for this resource.
If specified, it will be inherited by child resources unless overriden when creating those child resources.
The following properties can be specified:

Type:

object({
    kind = string
    name = optional(string, null)
  })

Default: null

managed_identities

Description: Defaults to {}. Controls the Managed Identity configuration on this resource. The following properties can be specified:

Type:

object({
    system_assigned            = optional(bool, false)
    user_assigned_resource_ids = optional(set(string), [])
  })

Default: {}

minimum_tls_version

Description: Defaults to 1.2. The minimum supported TLS version for this Service Bus Namespace. Valid values are: 1.0, 1.1 and 1.2.

Type: string

Default: "1.2"

network_rule_config

Description: Defaults to {}. IP rules only for Basic and Standard, virtual network or IP rules for Premium. Defines the network rules configuration for the resource.

Type:

object({
    trusted_services_allowed = optional(bool, false)
    cidr_or_ip_rules         = optional(set(string), [])
    default_action           = optional(string, "Allow")

    network_rules = optional(set(object({
      subnet_id = string
    })), [])
  })

Default: {}

premium_messaging_partitions

Description: Always set to 0 for Standard and Basic. Defaults to 1 for Premium. Specifies the number of messaging partitions.
Possible values when Premium are 1, 2, and 4. Changing this forces a new resource to be created.

Type: number

Default: null

private_endpoints

Description: Default to {}. Ignored for Basic and Standard. A map of private endpoints to create. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.

Type:

map(object({
    subnet_resource_id = string

    name                                    = optional(string, null)
    private_dns_zone_group_name             = optional(string, "default")
    private_dns_zone_resource_ids           = optional(set(string), [])
    application_security_group_associations = optional(map(string), {})
    private_service_connection_name         = optional(string, null)
    network_interface_name                  = optional(string, null)
    location                                = optional(string, null)
    resource_group_name                     = optional(string, null)

    ip_configurations = optional(map(object({
      name               = string
      private_ip_address = string
    })), {})

    tags = optional(map(string), null)

    lock = optional(object({
      kind = string
      name = optional(string, null)
    }), null)

    role_assignments = optional(map(object({
      role_definition_id_or_name = string
      principal_id               = string

      description                            = optional(string, null)
      skip_service_principal_aad_check       = optional(bool, false)
      delegated_managed_identity_resource_id = optional(string, null)

      principal_type    = optional(string, null) # forced to be here by lint, not supported
      condition         = optional(string, null) # forced to be here by lint, not supported
      condition_version = optional(string, null) # forced to be here by lint, not supported
    })), {})
  }))

Default: {}

private_endpoints_manage_dns_zone_group

Description: Default to true. Whether to manage private DNS zone groups with this module. If set to false, you must manage private DNS zone groups externally, e.g. using Azure Policy.

Type: bool

Default: true

public_network_access_enabled

Description: Defaults to true. Is public network access enabled for the Service Bus Namespace?

Type: bool

Default: true

queues

Description: Defaults to {}. A map of queues to create.
The name of the queue must be unique among topics and queues within the namespace.

Type:

map(object({
    name                                    = optional(string, null)
    max_delivery_count                      = optional(number, 10)
    enable_batched_operations               = optional(bool, true)
    requires_duplicate_detection            = optional(bool, false)
    requires_session                        = optional(bool, false)
    dead_lettering_on_message_expiration    = optional(bool, false)
    enable_partitioning                     = optional(bool, null)
    enable_express                          = optional(bool, null)
    max_message_size_in_kilobytes           = optional(number, null)
    default_message_ttl                     = optional(string, null)
    forward_to                              = optional(string, null)
    forward_dead_lettered_messages_to       = optional(string, null)
    auto_delete_on_idle                     = optional(string, null)
    max_size_in_megabytes                   = optional(number, 1024)
    lock_duration                           = optional(string, "PT1M")
    duplicate_detection_history_time_window = optional(string, "PT10M")
    status                                  = optional(string, "Active")

    authorization_rules = optional(map(object({
      name   = optional(string, null)
      send   = optional(bool, false)
      listen = optional(bool, false)
      manage = optional(bool, false)
    })), {})

    role_assignments = optional(map(object({
      role_definition_id_or_name = string
      principal_id               = string

      description                            = optional(string, null)
      skip_service_principal_aad_check       = optional(bool, false)
      delegated_managed_identity_resource_id = optional(string, null)
    })), {})
  }))

Default: {}

role_assignments

Description: Defaults to {}. A map of role assignments to create. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.

Type:

map(object({
    role_definition_id_or_name = string
    principal_id               = string

    description                            = optional(string, null)
    skip_service_principal_aad_check       = optional(bool, false)
    delegated_managed_identity_resource_id = optional(string, null)

    principal_type    = optional(string, null) # forced to be here by lint, not supported
    condition         = optional(string, null) # forced to be here by lint, not supported
    condition_version = optional(string, null) # forced to be here by lint, not supported
  }))

Default: {}

sku

Description: Defaults to Standard. Defines which tier to use. Options are Basic, Standard or Premium.
Please note that setting this field to Premium will force the creation of a new resource.

Type: string

Default: "Standard"

tags

Description: Defaults to {}. A mapping of tags to assign to the resource. These tags will propagate to any child resource unless overriden when creating the child resource

Example Inputs:

  tags = {
    environment = "testing"
  }

Type: map(string)

Default: null

topics

Description: Defaults to {}. Ignored for Basic. A map of topics to create.
The name of the topic must be unique among topics and queues within the namespace.

Type:

map(object({
    name                                    = optional(string, null)
    enable_batched_operations               = optional(bool, true)
    requires_duplicate_detection            = optional(bool, false)
    enable_partitioning                     = optional(bool, null)
    enable_express                          = optional(bool, null)
    support_ordering                        = optional(bool, false)
    max_message_size_in_kilobytes           = optional(number, null)
    default_message_ttl                     = optional(string, null)
    auto_delete_on_idle                     = optional(string, null)
    max_size_in_megabytes                   = optional(number, 1024)
    duplicate_detection_history_time_window = optional(string, "PT10M")
    status                                  = optional(string, "Active")

    authorization_rules = optional(map(object({
      name   = optional(string, null)
      send   = optional(bool, false)
      listen = optional(bool, false)
      manage = optional(bool, false)
    })), {})

    subscriptions = optional(map(object({
      name                                      = optional(string, null)
      max_delivery_count                        = optional(number, 10)
      dead_lettering_on_filter_evaluation_error = optional(bool, true)
      enable_batched_operations                 = optional(bool, true)
      dead_lettering_on_message_expiration      = optional(bool, false)
      requires_session                          = optional(bool, false)
      forward_to                                = optional(string, null)
      forward_dead_lettered_messages_to         = optional(string, null)
      auto_delete_on_idle                       = optional(string, null)
      default_message_ttl                       = optional(string, null)
      lock_duration                             = optional(string, "PT1M")
      status                                    = optional(string, "Active")
    })), {})

    role_assignments = optional(map(object({
      role_definition_id_or_name = string
      principal_id               = string

      description                            = optional(string, null)
      skip_service_principal_aad_check       = optional(bool, false)
      delegated_managed_identity_resource_id = optional(string, null)
    })), {})
  }))

Default: {}

zone_redundant

Description: Always set to false for Standard and Basic. Defaults to true for Premium. Whether or not this resource is zone redundant.
Changing this forces a new resource to be created.

Type: bool

Default: null

Outputs

The following outputs are exported:

resource

Description: The service bus namespace created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/servicebus_namespace.html#attributes-reference

resource_authorization_rules

Description: The service bus namespace authorization rules created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/servicebus_namespace_authorization_rule#attributes-reference

resource_diagnostic_settings

Description: The diagnostic settings created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_diagnostic_setting#attributes-reference

resource_id

Description: The resource ID of the service bus namespace created.

resource_locks

Description: The management locks created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/management_lock#attributes-reference

resource_private_endpoints

Description: A map of the private endpoints created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint#attributes-reference

resource_private_endpoints_application_security_group_association

Description: The private endpoint application security group associations created

resource_queues

Description: The service bus queues created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint_application_security_group_association#attributes-reference

resource_queues_authorization_rules

Description: The service bus queues authorization rules created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/servicebus_queue_authorization_rule#attributes-reference

resource_role_assignments

Description: The role assignments created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment#attributes-reference

resource_topics

Description: The service bus topics created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/servicebus_topic.html#attributes-reference

resource_topics_authorization_rules

Description: The service bus topics authorization rules created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/servicebus_topic_authorization_rule#attributes-reference

resource_topics_subscriptions

Description: The service bus topic subscriptions created. More info: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/servicebus_subscription#attributes-reference

Modules

No modules.

Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.