-
Notifications
You must be signed in to change notification settings - Fork 0
/
servicebus.tf
53 lines (44 loc) · 1.75 KB
/
servicebus.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
locals {
servicebus_namespace_name = "${var.product}-servicebus-${var.env}"
}
module "servicebus-namespace" {
providers = {
azurerm.private_endpoint = azurerm.private_endpoint
}
source = "[email protected]:hmcts/terraform-module-servicebus-namespace?ref=4.x"
name = local.servicebus_namespace_name
location = var.location
sku = "Basic"
resource_group_name = azurerm_resource_group.shared_resource_group.name
env = var.env
common_tags = var.common_tags
project = var.project
}
resource "azurerm_servicebus_queue" "this" {
name = "recipes"
namespace_id = module.servicebus-namespace.id
default_message_ttl = "P1D" # 1 day
}
resource "azurerm_role_assignment" "plum_servicebus_data_receiver" {
principal_id = module.vault.managed_identity_objectid[0]
scope = module.servicebus-namespace.id
role_definition_name = "Azure Service Bus Data Receiver"
}
data "azurerm_user_assigned_identity" "keda" {
name = "keda-${var.env}-mi"
resource_group_name = "managed-identities-${var.env}-rg"
}
resource "azurerm_role_assignment" "keda_servicebus_data_receiver" {
principal_id = data.azurerm_user_assigned_identity.keda.principal_id
scope = module.servicebus-namespace.id
role_definition_name = "Azure Service Bus Data Receiver"
}
data "azuread_group" "platops" {
display_name = "DTS Platform Operations"
security_enabled = true
}
resource "azurerm_role_assignment" "platops_servicebus_data_owner" {
principal_id = data.azuread_group.platops.object_id
scope = module.servicebus-namespace.id
role_definition_name = "Azure Service Bus Data Owner"
}