This Terraform module creates an Azure Service Bus.
Module version | Terraform version | OpenTofu version | AzureRM version |
---|---|---|---|
>= 8.x.x | Unverified | 1.8.x | >= 4.0 |
>= 7.x.x | 1.3.x | >= 3.0 | |
>= 6.x.x | 1.x | >= 3.0 | |
>= 5.x.x | 0.15.x | >= 2.0 | |
>= 4.x.x | 0.13.x / 0.14.x | >= 2.0 | |
>= 3.x.x | 0.12.x | >= 2.0 | |
>= 2.x.x | 0.12.x | < 2.0 | |
< 2.x.x | 0.11.x | < 2.0 |
If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.
More details are available in the CONTRIBUTING.md file.
This module is optimized to work with the Claranet terraform-wrapper tool
which set some terraform variables in the environment needed by this module.
More details about variables set by the terraform-wrapper
available in the documentation.
module "azure_region" {
source = "claranet/regions/azurerm"
version = "x.x.x"
azure_region = var.azure_region
}
module "rg" {
source = "claranet/rg/azurerm"
version = "x.x.x"
location = module.azure_region.location
client_name = var.client_name
environment = var.environment
stack = var.stack
}
module "logs" {
source = "claranet/run/azurerm//modules/logs"
version = "x.x.x"
client_name = var.client_name
environment = var.environment
stack = var.stack
location = module.azure_region.location
location_short = module.azure_region.location_short
resource_group_name = module.rg.resource_group_name
}
data "azurerm_subnet" "example" {
name = "backend"
virtual_network_name = "production"
resource_group_name = module.rg.resource_group_name
}
module "servicebus" {
source = "claranet/service-bus/azurerm"
version = "x.x.x"
location = module.azure_region.location
location_short = module.azure_region.location_short
client_name = var.client_name
environment = var.environment
stack = var.stack
resource_group_name = module.rg.resource_group_name
namespace_parameters = {
sku = "Premium"
}
namespace_authorizations = {
listen = true
send = false
}
# Network rules
network_rules_enabled = true
trusted_services_allowed = true
allowed_cidrs = [
"1.2.3.4/32",
]
subnet_ids = [
data.azurerm_subnet.example.id,
]
servicebus_queues = [{
name = "myqueue"
default_message_ttl = "P1D" # 1 day
dead_lettering_on_message_expiration = true
authorizations = {
listen = true
send = false
}
}]
servicebus_topics = [{
name = "mytopic"
default_message_ttl = 5 # 5min
authorizations = {
listen = true
send = true
manage = false
}
subscriptions = [{
name = "mainsub"
max_delivery_count = 10
enable_batched_operations = true
lock_duration = 1 # 1 min
}]
}]
logs_destinations_ids = [
module.logs.logs_storage_account_id,
module.logs.log_analytics_workspace_id
]
extra_tags = {
foo = "bar"
}
}
Name | Version |
---|---|
azurecaf | ~> 1.2, >= 1.2.22 |
azurerm | ~> 3.93 |
Name | Source | Version |
---|---|---|
diagnostics | claranet/diagnostic-settings/azurerm | ~> 7.0.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
allowed_cidrs | List of CIDR to allow access to that Service Bus Namespace. | list(string) |
[] |
no |
client_name | Client name/account used in naming | string |
n/a | yes |
custom_diagnostic_settings_name | Custom name of the diagnostics settings, name will be 'default' if not set. | string |
"default" |
no |
default_firewall_action | Which default firewalling policy to apply. Valid values are Allow or Deny . |
string |
"Deny" |
no |
default_tags_enabled | Option to enable or disable default tags | bool |
true |
no |
environment | Project environment | string |
n/a | yes |
extra_tags | Extra tags to add | map(string) |
{} |
no |
identity_ids | Specifies a list of User Assigned Managed Identity IDs to be assigned to this Service Bus. | list(string) |
null |
no |
identity_type | Specifies the type of Managed Service Identity that should be configured on this Service Bus. Possible values are SystemAssigned , UserAssigned , SystemAssigned, UserAssigned (to enable both). |
string |
"SystemAssigned" |
no |
location | Azure location for Servicebus. | string |
n/a | yes |
location_short | Short string for Azure location. | string |
n/a | yes |
logs_categories | Log categories to send to destinations. | list(string) |
null |
no |
logs_destinations_ids | List of destination resources IDs for logs diagnostic destination. Can be Storage Account , Log Analytics Workspace and Event Hub . No more than one of each can be set.If you want to specify an Azure EventHub to send logs and metrics to, you need to provide a formated string with both the EventHub Namespace authorization send ID and the EventHub name (name of the queue to use in the Namespace) separated by the ` |
` character. | list(string) |
n/a |
logs_metrics_categories | Metrics categories to send to destinations. | list(string) |
null |
no |
name_prefix | Optional prefix for the generated name | string |
"" |
no |
name_suffix | Optional suffix for the generated name | string |
"" |
no |
namespace_authorizations | Object to specify which Namespace Authorization Rules need to be created. | object({ |
{} |
no |
namespace_parameters | Object to handle Service Bus Namespace options.custom_name = To override default resource name, generated if not set. |
object({ |
{} |
no |
network_rules_enabled | Boolean to enable Network Rules on the Service Bus Namespace, requires trusted_services_allowed , allowed_cidrs , subnet_ids or default_firewall_action correctly set if enabled. |
bool |
false |
no |
resource_group_name | Name of the resource group | string |
n/a | yes |
servicebus_queues | List of objects to create Queues with their options.name = Short Queue name. |
list(object({ |
[] |
no |
servicebus_topics | List of objects to create Topics with their options.name = Short Topic name. |
list(object({ |
[] |
no |
stack | Project stack name | string |
n/a | yes |
subnet_ids | Subnets to allow access to that Service Bus Namespace. | list(string) |
[] |
no |
trusted_services_allowed | If True, then Azure Services that are known and trusted for this resource type are allowed to bypass firewall configuration. | bool |
true |
no |
use_caf_naming | Use the Azure CAF naming provider to generate default resource name. custom_name override this if set. Legacy default name is used if this is set to false . |
bool |
true |
no |
Name | Description |
---|---|
namespace | Service Bus Namespace outputs. |
namespace_listen_authorization_rule | Service Bus namespace listen only authorization rule. |
namespace_manage_authorization_rule | Service Bus namespace manage authorization rule. |
namespace_send_authorization_rule | Service Bus namespace send only authorization rule. |
queues | Service Bus queues outputs. |
queues_listen_authorization_rule | Service Bus queues listen only authorization rules. |
queues_manage_authorization_rule | Service Bus queues manage authorization rules. |
queues_send_authorization_rule | Service Bus queues send only authorization rules. |
subscriptions | Service Bus topics subscriptions outputs. |
topics | Service Bus topics outputs. |
topics_listen_authorization_rule | Service Bus topics listen only authorization rules. |
topics_manage_authorization_rule | Service Bus topics manage authorization rules. |
topics_send_authorization_rule | Service Bus topics send only authorization rules. |
Microsoft Azure documentation: docs.microsoft.com/en-us/azure/service-bus/