Skip to content

Commit 075cdf1

Browse files
author
radomarina
committed
feat: v1.3.0
1 parent 25ab301 commit 075cdf1

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
.terraform
3+
.terraform.lock.hcl

eventdriven.tf

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
resource "azurerm_resource_group" "current" {
2-
count = var.eventdriven_enabled && var.existing_resource_group_name == "" ? 1 : 0
2+
count = var.existing_resource_group_name == "" ? 1 : 0
33
provider = azurerm.deployment_subscription
44
location = var.location
55
name = "${module.naming.resource_group.name}-${var.prefix}firefly${var.suffix}"
66
tags = local.tags
77
}
88

99
resource "azurerm_storage_account" "current" {
10-
count = var.eventdriven_enabled && var.existing_storage_account_id == "" ? 1 : 0
10+
count = var.existing_storage_account_id == "" ? 1 : 0
1111
provider = azurerm.deployment_subscription
1212
account_replication_type = "LRS"
1313
cross_tenant_replication_enabled = false
@@ -26,7 +26,7 @@ resource "azurerm_storage_account" "current" {
2626
}
2727

2828
resource "azurerm_eventgrid_system_topic" "current" {
29-
count = var.eventdriven_enabled && var.existing_eventgrid_topic_name == "" ? 1 : 0
29+
count = var.existing_eventgrid_topic_name == "" ? 1 : 0
3030
provider = azurerm.deployment_subscription
3131
name = "${module.naming.eventgrid_topic.name}-${var.prefix}firefly${var.suffix}"
3232
location = var.location
@@ -37,7 +37,7 @@ resource "azurerm_eventgrid_system_topic" "current" {
3737
}
3838

3939
resource "azurerm_eventgrid_system_topic_event_subscription" "current" {
40-
count = var.eventdriven_enabled && var.existing_eventgrid_topic_name == "" ? 1 : 0
40+
count = var.existing_eventgrid_topic_name == "" ? 1 : 0
4141
provider = azurerm.deployment_subscription
4242
name = "${module.naming.eventgrid_event_subscription.name}-${var.prefix}firefly${var.suffix}"
4343
resource_group_name = local.resource_group_name
@@ -56,7 +56,6 @@ resource "azurerm_eventgrid_system_topic_event_subscription" "current" {
5656
}
5757

5858
resource "azurerm_role_definition" "FireflyStorageAccountBlobReader" {
59-
count = var.eventdriven_enabled ? 1 : 0
6059
provider = azurerm.deployment_subscription
6160

6261
name = "${module.naming.role_definition.name}-${var.prefix}FireflyStorageAccountBlobReader-${var.subscription_id}${var.suffix}"
@@ -74,7 +73,6 @@ resource "azurerm_role_definition" "FireflyStorageAccountBlobReader" {
7473
}
7574

7675
resource "azurerm_role_assignment" "FireflyStorageAccountBlobReader" {
77-
count = var.eventdriven_enabled ? 1 : 0
7876
provider = azurerm.deployment_subscription
7977

8078
principal_id = azuread_service_principal.current.id
@@ -100,7 +98,7 @@ EOT
10098
}
10199

102100
resource "azurerm_monitor_diagnostic_setting" "current" {
103-
for_each = var.eventdriven_enabled ? local.kv_filtered_subscriptions : {}
101+
for_each = local.kv_filtered_subscriptions
104102
provider = azurerm.deployment_subscription
105103
name = "${module.naming.monitor_diagnostic_setting.name}-${var.prefix}firefly${each.key}${var.suffix}"
106104
target_resource_id = "/subscriptions/${each.key}"

locals.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
locals {
22
filtered_subscriptions = [for subscription in data.azurerm_subscriptions.current.subscriptions : subscription if !contains(keys(subscription.tags), "disable_firefly_discovery") && subscription.state == "Enabled"]
3-
kv_filtered_subscriptions = var.eventdriven_auto_discover && length(local.filtered_subscriptions) > 0 ? { for subscription in local.filtered_subscriptions : subscription.subscription_id => subscription.display_name } : { "${var.subscription_id}" = data.azurerm_subscription.current.display_name }
3+
kv_filtered_subscriptions = var.auto_discover_enabled && length(local.filtered_subscriptions) > 0 ? { for subscription in local.filtered_subscriptions : subscription.subscription_id => subscription.display_name } : { "${var.subscription_id}" = data.azurerm_subscription.current.display_name }
44

55
resource_group_id = var.existing_resource_group_name != "" ? var.existing_resource_group_name : azurerm_resource_group.current[0].id
66
resource_group_name = var.existing_resource_group_name != "" ? var.existing_resource_group_name : azurerm_resource_group.current[0].name
77
storage_account_id = var.existing_storage_account_id != "" ? var.existing_storage_account_id : azurerm_storage_account.current[0].id
88

99

1010
eventgrid_system_topic_name = var.existing_eventgrid_topic_name != "" ? var.existing_eventgrid_topic_name : azurerm_eventgrid_system_topic.current[0].name
11-
subscription_suffix = var.eventdriven_auto_discover ? "" : "-${var.subscription_id}"
11+
subscription_suffix = var.auto_discover_enabled ? "" : "-${var.subscription_id}"
1212
tags = merge(var.tags, {
1313
"firefly" = "true"
1414
})

permission.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
locals {
22
management_group_id = var.management_group_id != "" ? "/providers/Microsoft.Management/managementGroups/${var.management_group_id}" : data.azurerm_management_group.current.id
3-
scope = var.eventdriven_auto_discover != "" ? local.management_group_id : "/subscriptions/${var.subscription_id}"
3+
scope = var.auto_discover_enabled != "" ? local.management_group_id : "/subscriptions/${var.subscription_id}"
44
}
55

66
resource "azuread_application_registration" "current" {

0 commit comments

Comments
 (0)