File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
modules/agentless-scanning Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,21 @@ locals {
17
17
flatten ([for m in data . azurerm_management_group . management_groups : m . all_subscription_ids ]))
18
18
}
19
19
20
+ data "azurerm_subscription" "all_subscriptions" {
21
+ for_each = toset (local. subscriptions )
22
+ subscription_id = each. value
23
+ }
24
+
25
+ # Filter only the enabled subscriptions
26
+ locals {
27
+ enabled_subscription_ids = [
28
+ for s in data . azurerm_subscription . all_subscriptions :
29
+ s . subscription_id if s . state == " Enabled"
30
+ ]
31
+ }
32
+
20
33
resource "azurerm_lighthouse_assignment" "lighthouse_assignment_for_tenant" {
21
- for_each = var. is_organizational ? toset (local. subscriptions ) : toset ([])
34
+ for_each = var. is_organizational ? toset (local. enabled_subscription_ids ) : toset ([])
22
35
23
36
scope = " /subscriptions/${ each . value } "
24
37
lighthouse_definition_id = azurerm_lighthouse_definition. lighthouse_definition . id
You can’t perform that action at this time.
0 commit comments