-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
4f32a0c
commit ca8ce6c
Showing
11 changed files
with
334 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tests/PSRule.Rules.Azure.Tests/Bicep/ScopeTestCases/Tests.Bicep.3.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// Test case for https://github.com/Azure/PSRule.Rules.Azure/issues/3237 | ||
|
||
// Based on AVM subscription placement module. | ||
|
||
targetScope = 'tenant' | ||
|
||
module mg './Tests.Bicep.3.child1.bicep' = { | ||
name: 'mg' | ||
scope: tenant() | ||
} | ||
|
||
module child './Tests.Bicep.3.child2.bicep' = { | ||
name: 'child' | ||
params: { | ||
managementGroups: [ | ||
{ | ||
id: mg.outputs.managementGroupId | ||
subscriptionId: mg.outputs.subscriptionId | ||
} | ||
] | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/PSRule.Rules.Azure.Tests/Bicep/ScopeTestCases/Tests.Bicep.3.child1.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
targetScope = 'tenant' | ||
|
||
resource managementGroup 'Microsoft.Management/managementGroups@2023-04-01' = { | ||
name: 'mg-test' | ||
properties: { | ||
displayName: 'Test Management Group' | ||
details: { | ||
parent: { | ||
id: '' | ||
} | ||
} | ||
} | ||
} | ||
|
||
output managementGroupId string = managementGroup.id | ||
output subscriptionId string = '00000000-0000-0000-0000-000000000000' |
21 changes: 21 additions & 0 deletions
21
tests/PSRule.Rules.Azure.Tests/Bicep/ScopeTestCases/Tests.Bicep.3.child2.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
targetScope = 'tenant' | ||
|
||
param managementGroups managementGroup[] | ||
|
||
type managementGroup = { | ||
id: string | ||
subscriptionId: string | ||
} | ||
|
||
module customSubscriptionPlacement './Tests.Bicep.3.child3.bicep' = [ | ||
for (place, index) in managementGroups: { | ||
name: 'placement-${uniqueString(place.id)}${index}' | ||
params: { | ||
managementGroupId: place.id | ||
subscriptionId: place.subscriptionId | ||
} | ||
} | ||
] |
11 changes: 11 additions & 0 deletions
11
tests/PSRule.Rules.Azure.Tests/Bicep/ScopeTestCases/Tests.Bicep.3.child3.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
targetScope = 'tenant' | ||
|
||
param managementGroupId string | ||
param subscriptionId string | ||
|
||
resource customSubscriptionPlacement 'Microsoft.Management/managementGroups/subscriptions@2023-04-01' = { | ||
name: '${last(split(managementGroupId, '/'))}/${subscriptionId}' | ||
} |
Oops, something went wrong.