Skip to content

Commit 655314a

Browse files
Revert "fix(bicep): resolve ARM eager-eval index-out-of-bounds on EventHub namespace vars"
This reverts commit 50f93ec.
1 parent 25d0fc1 commit 655314a

4 files changed

Lines changed: 10 additions & 11 deletions

File tree

infra/main.bicep

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,17 @@ param existingFabricCapacityName string = ''
7575

7676
var useExistingEventHubNamespace = !empty(existingEventHubNamespaceId)
7777
// ARM eagerly evaluates both ternary branches at validation time, causing split('', '/')[n]
78-
// to throw index-out-of-bounds when the param is empty. Normalise to a structurally valid
79-
// ARM resource ID using the nil GUID (00000000-...) as subscription — a GUID Azure never
80-
// issues — so scope: resourceGroup(...) passes validation but can never target anything real.
81-
// The module is still gated by if(useExistingEventHubNamespace) and never deploys unless
82-
// a real existing namespace ID is provided.
78+
// to throw index-out-of-bounds when the param is empty. Provide a structurally valid
79+
// placeholder so the split is always safe. The nil GUID can never match a real subscription.
8380
var _safeEventHubNamespaceId = empty(existingEventHubNamespaceId)
8481
? '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/placeholder/providers/Microsoft.EventHub/namespaces/placeholder'
8582
: existingEventHubNamespaceId
8683
// Extract name, subscription ID, and resource group from the resource ID.
87-
var eventHubNamespaceNameFromId = last(split(_safeEventHubNamespaceId, '/'))
88-
var eventHubNamespaceSubscriptionId = split(_safeEventHubNamespaceId, '/')[2]
89-
var eventHubNamespaceResourceGroup = split(_safeEventHubNamespaceId, '/')[4]
84+
// Supports cross-subscription/cross-resource-group deployments
85+
// (e.g. namespace in sub-123/rg-shared while deploying to sub-456/rg-demo).
86+
var eventHubNamespaceNameFromId = useExistingEventHubNamespace ? last(split(_safeEventHubNamespaceId, '/')) : ''
87+
var eventHubNamespaceSubscriptionId = useExistingEventHubNamespace ? split(_safeEventHubNamespaceId, '/')[2] : ''
88+
var eventHubNamespaceResourceGroup = useExistingEventHubNamespace ? split(_safeEventHubNamespaceId, '/')[4] : ''
9089
var useExistingFabricCapacity = !empty(existingFabricCapacityName)
9190

9291
var solutionSuffix = toLower(trim(replace(

infra/scripts/fabric/fabric_data_ingester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def load_data_to_fabric(
274274
args = parser.parse_args()
275275

276276
try:
277-
load_data_to_fabric(
277+
_results = load_data_to_fabric(
278278
cluster_uri=args.cluster_uri,
279279
database_name=args.database,
280280
data_path=args.data_path,

infra/scripts/fabric/fabric_environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import os
2323
import base64
2424
from typing import Optional, Dict, Any
25-
from fabric_api import FabricWorkspaceApiClient
25+
from fabric_api import FabricWorkspaceApiClient, FabricApiError
2626

2727

2828
def read_environment_yml(file_path: str) -> str:

src/sample_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def generate_sample_data(
318318

319319

320320
if __name__ == "__main__":
321-
generate_sample_data(
321+
_result = generate_sample_data(
322322
num_sites=2,
323323
num_assets_per_site=1,
324324
num_products=20,

0 commit comments

Comments
 (0)