Skip to content

hmcts/terraform-module-servicebus-namespace

Repository files navigation

terraform-module-servicebus-namespace

A Terraform module for creating an Azure Service Bus namespace. Refer to the following link for a detailed explanation of the Azure Service Bus namespace.

Azure Service Bus Namespace

Usage

Recommended example for cost optimisation

Premium service bus namespaces are very expensive, care must be taken when using them and only used in required environments. This should only be production unless you really need it in a different environment.

variables.tf

variable "service_bus_sku" {
  default = "Standard"
}

prod.tfvars

service_bus_sku = "Premium"

service-bus.tf

module "servicebus_namespace" {
  source                  = "git@github.com:hmcts/terraform-module-servicebus-namespace?ref=4.x"
  name                    = "${var.product}-${var.component}"
  resource_group_name     = azurerm_resource_group.shared_resource_group.name
  location                = var.location
  env                     = var.env
  common_tags             = var.common_tags
  project                 = var.project # cft or sds
  sku                     = var.service_bus_sku
}

Private endpoint

This module does support accessing privately but private endpoint is currently only supported in premium namespaces which are incredibly expensive, (~£500 per month instead of £7). Only use this if you have to and minimise the environments you use it in.

variables.tf

variable "servicebus_enable_private_endpoint" {
  default = false
}

prod.tfvars

servicebus_enable_private_endpoint = true

service-bus.tf

module "servicebus_namespace" {
  source                  = "git@github.com:hmcts/terraform-module-servicebus-namespace?ref=4.x"
  ...
  enable_private_endpoint = var.servicebus_enable_private_endpoint
}

Requirements

Name Version
azurerm >= 3.0.0

Inputs

Name Description Type Default Required
capacity Specifies the capacity. Defaults to 1 when using Premium SKU. number 0 no
common_tags n/a map(string) n/a yes
enable_private_endpoint Enable Private endpoint? Only available with the Premium SKU, if set to true a Premium type Service Bus Namespace will be deployed automatically bool false no
enable_public_access Enable public access (should only be enabled for a migration when using the Premium SKU and a private endpoint connection) bool false no
env n/a string n/a yes
location n/a string "UK South" no
name Unique Azure Service Bus namespace string n/a yes
premium_messaging_partitions Specifies the number of messaging partitions. Defaults to 1 when using Premium SKU. Options when using Premium SKU are (1, 2, 4). number 0 no
project Project name (required for Premium SKU) - sds or cft. string "" no
resource_group_name Resource group in which the Service Bus namespace should exist string n/a yes
sku SKU type (Basic, Standard and Premium) string "Standard" no
subnet_id Subnet ID to attach private endpoint to - overrides the default subnet id string "" no

Outputs

Name Description
id n/a
name n/a
primary_send_and_listen_connection_string primary connection string for send and listen operations
primary_send_and_listen_shared_access_key primary shared access key with send and listen rights
secondary_send_and_listen_connection_string secondary connection string for send and listen operations
secondary_send_and_listen_shared_access_key secondary shared access key with send and listen rights
sku sku type

Terraform docs created with:

terraform-docs markdown table --output-file README.md --hide-empty=true --output-mode inject --show providers,inputs,outputs .

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages