generated from Azure/terraform-azurerm-avm-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.eventhub.tf
40 lines (36 loc) · 2.45 KB
/
main.eventhub.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
resource "azurerm_eventhub" "this" {
for_each = var.event_hubs
name = each.key
namespace_name = try(data.azurerm_eventhub_namespace.this[0].name, azurerm_eventhub_namespace.this[0].name)
resource_group_name = var.resource_group_name
partition_count = each.value.partition_count
message_retention = each.value.message_retention
status = each.value.status
dynamic "capture_description" {
for_each = each.value.capture_description != null ? { this = each.value.capture_description } : {}
content {
enabled = each.value.capture_description.enabled
encoding = each.value.capture_description.encoding
interval_in_seconds = each.value.capture_description.interval_in_seconds
size_limit_in_bytes = each.value.capture_description.size_limit_in_bytes
skip_empty_archives = each.value.capture_description.skip_empty_archives
destination {
name = each.value.capture_description.destination.name
archive_name_format = each.value.capture_description.destination.archive_name_format
blob_container_name = each.value.capture_description.destination.blob_container_name
storage_account_id = each.value.capture_description.destination.storage_account_id
}
}
}
}
resource "azurerm_role_assignment" "event_hubs" {
for_each = local.event_hub_role_assignments
scope = azurerm_eventhub.this[each.value.event_hub_key].id
role_definition_id = strcontains(lower(each.value.role_assignment.role_definition_id_or_name), lower(local.role_definition_resource_substring)) ? each.value.role_assignment.role_definition_id_or_name : null
role_definition_name = strcontains(lower(each.value.role_assignment.role_definition_id_or_name), lower(local.role_definition_resource_substring)) ? null : each.value.role_assignment.role_definition_id_or_name
principal_id = each.value.role_assignment.principal_id
condition = each.value.role_assignment.condition
condition_version = each.value.role_assignment.condition_version
skip_service_principal_aad_check = each.value.role_assignment.skip_service_principal_aad_check
delegated_managed_identity_resource_id = each.value.role_assignment.delegated_managed_identity_resource_id
}