Skip to content

Commit a54c8d3

Browse files
DTOSS-12822: use relay namespace ID output for RBAC scope instead of data source
1 parent 927fb79 commit a54c8d3

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

infrastructure/modules/container-apps/data.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,3 @@ data "azurerm_private_dns_zone" "storage-account-queue" {
2727
resource_group_name = "rg-hub-${var.hub}-uks-private-dns-zones"
2828
}
2929

30-
data "azurerm_relay_namespace" "relay" {
31-
count = var.relay_namespace_name != null ? 1 : 0
32-
name = var.relay_namespace_name
33-
resource_group_name = var.resource_group_name_infra
34-
}

infrastructure/modules/container-apps/relay.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ module "relay_send_role_assignment" {
2727
source = "../dtos-devops-templates/infrastructure/modules/rbac-assignment"
2828
principal_id = module.relay_send_identity[0].principal_id
2929
role_definition_name = "Azure Relay Sender"
30-
scope = data.azurerm_relay_namespace.relay[0].id
30+
scope = var.relay_namespace_id
3131
depends_on = [module.relay_send_identity]
3232
}

infrastructure/modules/container-apps/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ variable "relay_namespace_name" {
206206
default = null
207207
}
208208

209+
variable "relay_namespace_id" {
210+
description = "The ID of the Azure Relay namespace. Used for RBAC scope."
211+
type = string
212+
default = null
213+
}
214+
209215
locals {
210216
resource_group_name = "rg-${var.app_short_name}-${var.environment}-container-app-uks"
211217

infrastructure/modules/infra/output.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ output "relay_namespace_name" {
4242
value = var.enable_relay ? module.relay_namespace[0].name : null
4343
}
4444

45+
output "relay_namespace_id" {
46+
value = var.enable_relay ? module.relay_namespace[0].id : null
47+
}
48+
4549
output "servicebus_namespace_name" {
4650
value = var.enable_service_bus ? module.servicebus_namespace[0].namespace_name : null
4751
}

infrastructure/terraform/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ module "container-apps" {
8282
container_memory = var.container_memory
8383
min_replicas = var.min_replicas
8484
relay_namespace_name = var.deploy_infra ? module.infra[0].relay_namespace_name : null
85+
relay_namespace_id = var.deploy_infra ? module.infra[0].relay_namespace_id : null
8586
}

0 commit comments

Comments
 (0)