Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI Environment] Enabled CI environment to handle DeploymentTest (bicep) files for new self-contained dependency approach #1624

Merged
merged 308 commits into from
Aug 29, 2022
Merged
Changes from 1 commit
Commits
Show all changes
308 commits
Select commit Hold shift + click to select a range
70a6f1e
added missing address space
AlexanderSehr Jun 29, 2022
bceadac
Fix param ref
AlexanderSehr Jun 29, 2022
261ee47
Further refactoring
AlexanderSehr Jun 29, 2022
c3ba3ed
Update to latest
AlexanderSehr Jun 29, 2022
76b1b96
Update to latest
AlexanderSehr Jun 29, 2022
124bfdd
Fixed deployment ref
AlexanderSehr Jun 29, 2022
510442c
Update to latest
AlexanderSehr Jun 29, 2022
23f13e0
Updated GH piplines + minor improvements
AlexanderSehr Jun 29, 2022
ca75794
Fixed ref
AlexanderSehr Jun 29, 2022
c3c3c8c
another try
AlexanderSehr Jun 29, 2022
b4d5d3c
Another try
AlexanderSehr Jun 29, 2022
467bd16
Fixed GH pipeline
AlexanderSehr Jun 29, 2022
2d536fe
Updated names
AlexanderSehr Jun 29, 2022
b81d4d5
Rename
AlexanderSehr Jun 29, 2022
28224b6
Stardted refactoring the readme function
AlexanderSehr Jun 29, 2022
ee95d1c
Renamed var
AlexanderSehr Jun 29, 2022
6f8504d
Update modules/.global/global.module.tests.ps1
AlexanderSehr Jun 29, 2022
ba05015
Update to latest
AlexanderSehr Jun 29, 2022
4eb3b0b
Merge branch 'users/alsehr/1577_RenameFolder2' of https://github.com/…
AlexanderSehr Jun 29, 2022
0b28416
Merge branch 'main' into users/alsehr/1577_RenameFolder2
AlexanderSehr Jun 29, 2022
1ad3623
Renamed variable
AlexanderSehr Jun 29, 2022
c131584
Further updates
AlexanderSehr Jun 29, 2022
b3c1cf3
Mreged latest base branch
AlexanderSehr Jun 29, 2022
dd75daf
Merged latest main
AlexanderSehr Jun 30, 2022
f3d9f07
Merge branch 'main' into users/alsehr/1583_dependencyVar5
AlexanderSehr Jun 30, 2022
0dca935
[Utilities] Updated ReadMe Utility to handle bicep test files when ge…
AlexanderSehr Jun 30, 2022
161c785
Merge branch 'users/alsehr/1583_dependencyVar5' of https://github.com…
AlexanderSehr Jun 30, 2022
b9434f2
Commenting
AlexanderSehr Jun 30, 2022
445129a
Formatting update
AlexanderSehr Jun 30, 2022
f02cb14
Added order
AlexanderSehr Jun 30, 2022
a0b23c9
Added support for ARM deployment test file
AlexanderSehr Jul 1, 2022
09cf924
Updated handling of ARM-JSON deployment files + updated tests
AlexanderSehr Jul 1, 2022
d07f74f
Update to latest
AlexanderSehr Jul 1, 2022
defae14
Small updates
AlexanderSehr Jul 1, 2022
303f224
Small updates
AlexanderSehr Jul 1, 2022
0b12667
Added documentation
AlexanderSehr Jul 1, 2022
7078e9c
Added docs
AlexanderSehr Jul 2, 2022
f65d18e
Update to latest
AlexanderSehr Jul 3, 2022
77467ff
Merge branch 'main' into users/alsehr/1583_dependencyVar5
AlexanderSehr Jul 4, 2022
7d149f2
Regenerated docs
AlexanderSehr Jul 4, 2022
c6e4cd8
Added config exception
AlexanderSehr Jul 4, 2022
8944fb7
Added config exception
AlexanderSehr Jul 4, 2022
50175bc
Mergef first couple changes from PR 1632
AlexanderSehr Jul 8, 2022
62c94e5
Merged first batch of set-moduleReadMe script updates (not yet compat…
AlexanderSehr Jul 10, 2022
de6068c
Latest draft including bicep to json intermediate format
AlexanderSehr Jul 10, 2022
80e5edb
Further improvements when dealing with classic parameter files
AlexanderSehr Jul 10, 2022
1a56e58
Updated function & tested arm converted test file
AlexanderSehr Jul 10, 2022
cd4dde8
Updated comments
AlexanderSehr Jul 10, 2022
1438e13
Added SQL server example & updated readme robustness
AlexanderSehr Jul 12, 2022
a74a2d6
Added SQL server example & updated readme robustness
AlexanderSehr Jul 12, 2022
f8a23dd
Updated pipeline
AlexanderSehr Jul 13, 2022
56400c5
Merged latest main
AlexanderSehr Jul 13, 2022
567f856
Added additional error handling
AlexanderSehr Jul 13, 2022
710d9f2
Fixed dpeloyment test
AlexanderSehr Jul 13, 2022
36f804e
Updated docs
AlexanderSehr Jul 13, 2022
d47137e
Adjusted publishing
AlexanderSehr Jul 13, 2022
ae7a619
Adjusted var syntax
AlexanderSehr Jul 13, 2022
2b86826
Added initial draft for virtualHub
AlexanderSehr Jul 13, 2022
26377f0
Updated readme
AlexanderSehr Jul 13, 2022
6afb26b
Minor updates
AlexanderSehr Jul 13, 2022
39b987e
Updated readmes
AlexanderSehr Jul 13, 2022
8824790
Merge branch 'main' into users/alsehr/1583_dependencyVar5
AlexanderSehr Jul 14, 2022
2a162f9
Improved robustness
AlexanderSehr Jul 14, 2022
9b0eab2
Merged latest main
AlexanderSehr Jul 14, 2022
f84bede
Renamed folder
AlexanderSehr Jul 14, 2022
f2fee8c
Adjusted output
AlexanderSehr Jul 14, 2022
47c40ce
Removed redundant dependency
AlexanderSehr Jul 14, 2022
26599bd
Merged latest main
AlexanderSehr Jul 15, 2022
274d682
Regenerated docs
AlexanderSehr Jul 15, 2022
e569895
Updated Set-ModuleReadMe with Bicep support & regenerated docs
AlexanderSehr Jul 15, 2022
57e9fb1
Updated Set-ModuleReadMe with Bicep support & regenerated docs
AlexanderSehr Jul 15, 2022
6b06637
Updated comments
AlexanderSehr Jul 15, 2022
30963fa
Updated robustness
AlexanderSehr Jul 15, 2022
c79f4db
Updated robustness
AlexanderSehr Jul 15, 2022
3c1a59f
Updated docs
AlexanderSehr Jul 15, 2022
994ad66
Another update
AlexanderSehr Jul 15, 2022
ece3e5f
Changed casing
AlexanderSehr Jul 15, 2022
593b3ff
Merged latest main
AlexanderSehr Jul 15, 2022
42572e7
Added error handling
AlexanderSehr Jul 15, 2022
629061b
Added error handling
AlexanderSehr Jul 15, 2022
e9b66e1
Merged upstream branch
AlexanderSehr Jul 15, 2022
1acfbc5
Adjusted naming
AlexanderSehr Jul 15, 2022
952bd09
Refactored ADO dependency pipeline
AlexanderSehr Jul 15, 2022
57f0bc6
Refactored ADO dependency pipeline
AlexanderSehr Jul 15, 2022
e4787be
Renamed parameter
AlexanderSehr Jul 15, 2022
210f018
Added var
AlexanderSehr Jul 15, 2022
7e91cfe
Test replace
AlexanderSehr Jul 15, 2022
a952777
Test replace
AlexanderSehr Jul 15, 2022
8887b4b
Test replace
AlexanderSehr Jul 15, 2022
e6f52f4
Test replace
AlexanderSehr Jul 15, 2022
4fc70c2
Test replace
AlexanderSehr Jul 15, 2022
7f36e03
Attempt to parameterize parameter fetch for ADO
AlexanderSehr Jul 15, 2022
ebc3be4
Adjusted references
AlexanderSehr Jul 15, 2022
277f381
Small fix
AlexanderSehr Jul 15, 2022
14a747c
Adjusted references
AlexanderSehr Jul 15, 2022
c4ebef4
Added var
AlexanderSehr Jul 15, 2022
a762d4f
Added parameter file case handling
AlexanderSehr Jul 15, 2022
2d9fa43
Fixed condition
AlexanderSehr Jul 15, 2022
d9c88b2
Fixed ref
AlexanderSehr Jul 15, 2022
5e3fba3
Rename
AlexanderSehr Jul 15, 2022
6dd6b6b
Added copied dependency pipeline template
AlexanderSehr Jul 15, 2022
1d386cb
Simplified pipelines
AlexanderSehr Jul 15, 2022
5adba5c
Minor refactoring
AlexanderSehr Jul 16, 2022
6cd94d1
Removed modulePath param from dependency pipeline
AlexanderSehr Jul 16, 2022
e71a51e
Cleanup
AlexanderSehr Jul 16, 2022
8429eb1
Cleanup
AlexanderSehr Jul 16, 2022
6834615
Updated naming
AlexanderSehr Jul 16, 2022
caa62ea
Merged latest main
AlexanderSehr Jul 18, 2022
1ef763c
Update jobs.validateModuleDeployment.yml
AlexanderSehr Jul 18, 2022
d8a36a1
Cleanup
AlexanderSehr Jul 18, 2022
18b5564
Merge branch 'main' into users/alsehr/1583_dependencyVar5
AlexanderSehr Jul 18, 2022
bf77e4a
Update to latest
AlexanderSehr Jul 21, 2022
e35a707
Restructured folders
AlexanderSehr Jul 21, 2022
86e615e
Updated test to new dependency folder structure
AlexanderSehr Jul 21, 2022
d1cef82
Removed nameprefix from parameter
AlexanderSehr Jul 21, 2022
53c97ce
Merged latest main
AlexanderSehr Jul 21, 2022
c4be1f2
Merged latest main
AlexanderSehr Jul 21, 2022
1e9e50e
Update readmes
AlexanderSehr Jul 21, 2022
bd8f0ad
Merged latest main\
AlexanderSehr Jul 23, 2022
4ee39ef
Resolved conflicts
AlexanderSehr Jul 31, 2022
8526126
Merged latest main
AlexanderSehr Aug 2, 2022
316fa08
Merge branch 'main' into users/alsehr/1583_dependencyVar5
AlexanderSehr Aug 2, 2022
7cf084b
Update to latest
AlexanderSehr Aug 2, 2022
0921714
Merge branch 'main' into users/alsehr/1583_dependencyVar5
AlexanderSehr Aug 5, 2022
10e788a
Update to latest
AlexanderSehr Aug 5, 2022
6ee637a
Changed namePrefix param to token
AlexanderSehr Aug 5, 2022
b203be8
Removed namePrefix param leftovers
AlexanderSehr Aug 5, 2022
907c54e
Changed comments
AlexanderSehr Aug 5, 2022
9a3c580
Adjust case hanlding
AlexanderSehr Aug 5, 2022
6129ff4
Adjusted name prefix handling
AlexanderSehr Aug 5, 2022
69484fc
Merge branch 'main' into users/alsehr/1583_dependencyVar5
AlexanderSehr Aug 6, 2022
da8c3c2
Added output
AlexanderSehr Aug 6, 2022
c65acc8
Update to latest
AlexanderSehr Aug 6, 2022
a8baa8c
Disabled pester
AlexanderSehr Aug 6, 2022
ada3354
Update to latest
AlexanderSehr Aug 6, 2022
0e80d00
Refactored file handling
AlexanderSehr Aug 6, 2022
ee189aa
Fallback
AlexanderSehr Aug 6, 2022
36c2aa9
Update to latest
AlexanderSehr Aug 6, 2022
d880428
Update to latest
AlexanderSehr Aug 6, 2022
4d56ecf
Update to latest
AlexanderSehr Aug 6, 2022
90856b3
Update to latest
AlexanderSehr Aug 6, 2022
15e90fc
Update to latest
AlexanderSehr Aug 6, 2022
45eb854
Update to latest
AlexanderSehr Aug 6, 2022
72bc402
Merged latest main
AlexanderSehr Aug 10, 2022
b5e7bf9
Update to latest
AlexanderSehr Aug 10, 2022
95a872a
Removed namePrefix param
AlexanderSehr Aug 10, 2022
14b2e32
Merged latest main
AlexanderSehr Aug 13, 2022
e579b48
Minor fix
AlexanderSehr Aug 13, 2022
29d5943
Added VM draft
AlexanderSehr Aug 13, 2022
e738423
Improved case handling
AlexanderSehr Aug 14, 2022
a1722bb
Updated readme
AlexanderSehr Aug 14, 2022
8d4867c
Merged latest main
AlexanderSehr Aug 14, 2022
17c9842
Cleanup
AlexanderSehr Aug 14, 2022
71cfd54
Update to latest
AlexanderSehr Aug 14, 2022
612678e
Fixed Pester test
AlexanderSehr Aug 14, 2022
80ac8af
Update to latest
AlexanderSehr Aug 14, 2022
09c4f69
Update to latest
AlexanderSehr Aug 14, 2022
01bccec
Small fix
AlexanderSehr Aug 14, 2022
9f3e575
Another small fix for linux
AlexanderSehr Aug 14, 2022
76e638d
Fixed ref
AlexanderSehr Aug 14, 2022
5a2db3e
Merged latest main
AlexanderSehr Aug 14, 2022
0d490af
Another small fix
AlexanderSehr Aug 14, 2022
d5cf656
Update to latest
AlexanderSehr Aug 14, 2022
8e93d17
Update to latest
AlexanderSehr Aug 14, 2022
6c4bedd
Merge branch 'main' into users/alsehr/1583_dependencyVar5
AlexanderSehr Aug 14, 2022
7e4548b
Update to latest
AlexanderSehr Aug 14, 2022
3556fe7
Merged latest
AlexanderSehr Aug 14, 2022
b3b65cf
Added small upgrade to mgmtgroup removal + cleanup of pipeline
AlexanderSehr Aug 14, 2022
ec55a5f
Update to latest
AlexanderSehr Aug 14, 2022
29f5599
Fixed sa name
AlexanderSehr Aug 14, 2022
3b85c46
Renamed res
AlexanderSehr Aug 14, 2022
b159efc
Updated removal
AlexanderSehr Aug 14, 2022
c15182b
added commment
AlexanderSehr Aug 14, 2022
caec61c
Update to latest
AlexanderSehr Aug 14, 2022
29568c9
Update to latest
AlexanderSehr Aug 14, 2022
53faea2
Adjusted conditions
AlexanderSehr Aug 15, 2022
440abdb
Update to latest
AlexanderSehr Aug 15, 2022
26e3d20
Update to latest
AlexanderSehr Aug 15, 2022
21209fd
Update to latest
AlexanderSehr Aug 15, 2022
89acfe0
Updated ReadMe
AlexanderSehr Aug 15, 2022
395a743
Simplified names & updated readmes
AlexanderSehr Aug 15, 2022
f264661
Renamed RG
AlexanderSehr Aug 15, 2022
9f4e7f1
Fixed VM dependencies
AlexanderSehr Aug 15, 2022
63aa398
Naming update
AlexanderSehr Aug 15, 2022
b1cb94a
Updated VM dependencies
AlexanderSehr Aug 15, 2022
59902ce
Updated docs
AlexanderSehr Aug 15, 2022
9d885e4
Added missing role assignment
AlexanderSehr Aug 15, 2022
583d3eb
Small bracket fix
AlexanderSehr Aug 15, 2022
3f22b33
RoleAssignment fix
AlexanderSehr Aug 15, 2022
64a2906
Further fixes
AlexanderSehr Aug 15, 2022
7650310
Further fixes
AlexanderSehr Aug 15, 2022
05822d8
Further fixes
AlexanderSehr Aug 15, 2022
5387e24
Further fixes
AlexanderSehr Aug 15, 2022
f0c58ed
Sync
AlexanderSehr Aug 15, 2022
93b08b5
Fixed folder ref
AlexanderSehr Aug 15, 2022
7b56ff1
Adjuted lb
AlexanderSehr Aug 15, 2022
99cbe9a
Merged latest main
AlexanderSehr Aug 15, 2022
90299fa
Update to latest
AlexanderSehr Aug 15, 2022
ad7eefc
Update to latest
AlexanderSehr Aug 15, 2022
90a95e6
Update to latest
AlexanderSehr Aug 15, 2022
8572d5f
Added missing pipeline flag
AlexanderSehr Aug 15, 2022
387cc81
Adjusted output
AlexanderSehr Aug 15, 2022
ab804c3
Added docs for new dependencies approach
AlexanderSehr Aug 15, 2022
ca05e1a
Small update
AlexanderSehr Aug 15, 2022
69d781d
Fixed name
AlexanderSehr Aug 15, 2022
e32c236
Update to latest
AlexanderSehr Aug 15, 2022
ade838b
Reenabled param json compatibility
AlexanderSehr Aug 15, 2022
b0fee24
Updated SQL server api
AlexanderSehr Aug 15, 2022
3b65086
Update to latest
AlexanderSehr Aug 15, 2022
3d8aa73
Several fixes
AlexanderSehr Aug 15, 2022
7ee5df6
Update to latest
AlexanderSehr Aug 15, 2022
a5e820b
Update to latest
AlexanderSehr Aug 15, 2022
1f69584
Adjusted cond
AlexanderSehr Aug 15, 2022
de97a2f
Fixed removal
AlexanderSehr Aug 15, 2022
cecc96e
Added key rbac + small renames
AlexanderSehr Aug 16, 2022
263f6fa
small renames
AlexanderSehr Aug 16, 2022
c9f9145
Template fix
AlexanderSehr Aug 16, 2022
32a21e2
Updated cse
AlexanderSehr Aug 16, 2022
ccfac9b
Update naming
AlexanderSehr Aug 16, 2022
a0a74eb
Removed reworked modules from PR
AlexanderSehr Aug 16, 2022
d6b1a66
Update to latest
AlexanderSehr Aug 16, 2022
7305775
Update to latest
AlexanderSehr Aug 16, 2022
690ab39
Update to latest
AlexanderSehr Aug 16, 2022
8b24f84
Small readmeGen fix + improved readability
AlexanderSehr Aug 18, 2022
2ffcd56
Updated AutomationAccount
AlexanderSehr Aug 19, 2022
dddf98b
Small update
AlexanderSehr Aug 19, 2022
0f25876
Update to latest
AlexanderSehr Aug 19, 2022
67ade81
Update to latest
AlexanderSehr Aug 20, 2022
a700c88
Small regex update
AlexanderSehr Aug 20, 2022
159d210
typoe
AlexanderSehr Aug 23, 2022
bef0039
Added missing quote
AlexanderSehr Aug 23, 2022
eee9a27
Update Initialize-DeploymentRemoval.ps1
AlexanderSehr Aug 28, 2022
906cf05
Update Invoke-ResourcePostRemoval.ps1
AlexanderSehr Aug 28, 2022
d8dac1e
Update .azuredevops/pipelineTemplates/jobs.validateModuleDeployment.yml
AlexanderSehr Aug 28, 2022
0e0fd3e
Update .azuredevops/pipelineTemplates/jobs.validateModuleDeployment.yml
AlexanderSehr Aug 28, 2022
eb4e1f6
Update .azuredevops/pipelineTemplates/jobs.validateModuleDeployment.yml
AlexanderSehr Aug 28, 2022
33432be
Update .github/actions/templates/validateModuleDeployment/action.yml
AlexanderSehr Aug 28, 2022
8f9ba64
Update .github/actions/templates/validateModuleDeployment/action.yml
AlexanderSehr Aug 28, 2022
cd421d4
Update modules/.shared/dependencyConstructs/diagnostic.dependencies.b…
AlexanderSehr Aug 28, 2022
7b8c441
Update modules/.shared/dependencyConstructs/diagnostic.dependencies.b…
AlexanderSehr Aug 28, 2022
0a06581
Update modules/.shared/dependencyConstructs/diagnostic.dependencies.b…
AlexanderSehr Aug 28, 2022
8e8e6f6
Update modules/.shared/dependencyConstructs/diagnostic.dependencies.b…
AlexanderSehr Aug 28, 2022
fea76a8
Update modules/.shared/dependencyConstructs/diagnostic.dependencies.b…
AlexanderSehr Aug 28, 2022
2b6732e
Update docs/wiki/The CI environment - Static validation.md
AlexanderSehr Aug 28, 2022
d37aa95
Update docs/wiki/The library - Module design.md
AlexanderSehr Aug 28, 2022
b09c5e7
Update docs/wiki/The library - Module design.md
AlexanderSehr Aug 28, 2022
f220f28
Update to latest
AlexanderSehr Aug 29, 2022
e54f976
Update to latest
AlexanderSehr Aug 29, 2022
d9eb0a9
Update to latest
AlexanderSehr Aug 29, 2022
696bd96
Update to latest
AlexanderSehr Aug 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 41 additions & 12 deletions docs/wiki/The library - Module design.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ A **CARML module** consists of
A module usually represents a single resource or a set of closely related resources. For example, a storage account and the associated lock or virtual machine and network interfaces. Modules are located in the `modules` folder.

Also, each module should be implemented with all capabilities it and its children support. This includes

- `Locks`
- `Role assignments (RBAC)`
- `Diagnostic Settings`
Expand Down Expand Up @@ -104,7 +105,7 @@ Use the following naming standard for module files and folders:
- Module folders are in camelCase and their name reflects the main resource type of the Bicep module they are hosting (e.g., `storageAccounts`, `virtualMachines`).
- Extension resource modules are placed in the `.bicep` subfolder and named `nested_<crossReferencedResourceType>.bicep`

``` txt
```txt
Microsoft.<Provider>
└─ <service>
├─ .bicep
Expand All @@ -115,17 +116,18 @@ Use the following naming standard for module files and folders:
└─ readme.md
```

>**Example**: `nested_roleAssignments.bicep` in the `Microsoft.Web\sites\.bicep` folder contains the `site` resource RBAC implementation.
>``` txt
>Microsoft.Web
>└─ sites
> **Example**: `nested_roleAssignments.bicep` in the `Microsoft.Web\sites\.bicep` folder contains the `site` resource RBAC implementation.
>
> ```txt
> Microsoft.Web
> └─ sites
> ├─ .bicep
> | └─ nested_roleAssignments.bicep
> ├─ .test
> | └─ ...
> ├─ deploy.bicep
> └─ readme.md
>```
> ```

## Patterns

Expand Down Expand Up @@ -158,6 +160,7 @@ resource <mainResource>_lock 'Microsoft.Authorization/locks@2017-04-01' = if (!e
```

> **Note:** How locks are passed to other resource templates depends on the type of module relationship:
>
> - Child and extension resources
> - Locks are not automatically passed down, as they are inherited by default in Azure
> - The reference of the child/extension template should look similar to: `lock: contains(<childExtensionObject>, 'lock') ? <childExtensionObject>.lock : ''`
Expand All @@ -181,6 +184,7 @@ The RBAC deployment has 2 elements. A module that contains the implementation, a
<summary>Details</summary>

#### 1st Element in main resource

```bicep
@description('Optional. Array of role assignment objects that contain the \'roleDefinitionIdOrName\' and \'principalId\' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
param roleAssignments array = []
Expand All @@ -200,7 +204,8 @@ module <mainResource>_roleAssignments '.bicep/nested_roleAssignments.bicep' = [f
Here, you specify the platform roles available for the main resource.

The `builtInRoleNames` variable contains the list of applicable roles for the specific resource which the `nested_roleAssignments.bicep` template applies.
>**Note**: You use the helper script [Get-FormattedRBACRoles.ps1](./Contribution%20guide%20-%20Get%20formatted%20RBAC%20roles) to extract a formatted list of RBAC roles used in the CARML modules based on the RBAC lists in Azure.

> **Note**: You use the helper script [Get-FormattedRBACRoles.ps1](./Contribution%20guide%20-%20Get%20formatted%20RBAC%20roles) to extract a formatted list of RBAC roles used in the CARML modules based on the RBAC lists in Azure.

The element requires you to provide both the `principalIds` & `roleDefinitionOrIdName` to assign to the principal IDs. Also, the `resourceId` is target resource's resource ID that allows us to reference it as an `existing` resource. Note, the implementation of the `split` in the resource reference becomes longer the deeper you go in the child resource hierarchy.

Expand Down Expand Up @@ -318,11 +323,13 @@ resource <mainResource>_diagnosticSettings 'Microsoft.Insights/diagnosticsetting
scope: <mainResource>
}
```

</details>

<p>

### Private Endpoints

The Private Endpoint deployment has 2 elements. A module that contains the implementation, and a module reference in the parent resource. The first one loops through the endpoints we want to create, the second one processes them.

<details>
Expand Down Expand Up @@ -390,9 +397,12 @@ Within a bicep file, use the following conventions:
- `resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01'`
- `resource virtualMachine 'Microsoft.Compute/virtualMachines@2020-06-01'`
- Parent reference

- If working on a child resource, refrain from string concatenation and instead, use the parent reference via the `existing` keyword.
- The way this is implemented differs slightly the lower you go in the hierarchy. Note the following examples:

- 1st level child resource (example _storageAccount/blobService_)

```bicep
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' existing = {
name: storageAccountName
Expand All @@ -404,7 +414,9 @@ Within a bicep file, use the following conventions:
properties: {...}
}
```

- 2nd level child resource (example _storageAccount/blobService/container_)

```bicep
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' existing = {
name: storageAccountName
Expand All @@ -420,7 +432,9 @@ Within a bicep file, use the following conventions:
properties: {...}
}
```

- 3rd level child resource (example _storageAccount/blobService/container/immutabilityPolicies_)

```bicep
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' existing = {
name: storageAccountName
Expand All @@ -440,11 +454,12 @@ Within a bicep file, use the following conventions:
properties: {...}
}
```

## Modules

- Module symbolic names are in camel_Snake_Case, following the schema `<mainResourceType>_<referencedResourceType>` e.g., `storageAccount_fileServices`, `virtualMachine_nic`, `resourceGroup_roleAssignments`.
- Modules enable you to reuse code from a Bicep file in other Bicep files. As such, they're normally leveraged for deploying child resources (e.g., file services in a storage account), cross referenced resources (e.g., network interface in a virtual machine) or extension resources (e.g., role assignment in a resource group).
- When a module requires to deploy a resource whose resource type is outside of the main module's provider namespace, the module of this additional resource is referenced locally. For example, when extending the Key Vault module with Private Endpoints, instead of including in the Key Vault module an ad hoc implementation of a Private Endpoint, the Key Vault directly references the Private Endpoint module (i.e., `module privateEndpoint 'https://github.com/Azure/ResourceModules/blob/main/Microsoft.Network/privateEndpoints/deploy.bicep'`). Major benefits of this implementation are less code duplication, more consistency throughout the module library and allowing the consumer to leverage the full interface provided by the referenced module.
- Module symbolic names are in camel*Snake_Case, following the schema `<mainResourceType>*<referencedResourceType>`e.g.,`storageAccount_fileServices`, `virtualMachine_nic`, `resourceGroup_roleAssignments`.
MariusStorhaug marked this conversation as resolved.
Show resolved Hide resolved
- Modules enable you to reuse code from a Bicep file in other Bicep files. As such, they're normally leveraged for deploying child resources (e.g., file services in a storage account), cross referenced resources (e.g., network interface in a virtual machine) or extension resources (e.g., role assignment in a resource group).
- When a module requires to deploy a resource whose resource type is outside of the main module's provider namespace, the module of this additional resource is referenced locally. For example, when extending the Key Vault module with Private Endpoints, instead of including in the Key Vault module an ad hoc implementation of a Private Endpoint, the Key Vault directly references the Private Endpoint module (i.e., `module privateEndpoint 'https://github.com/Azure/ResourceModules/blob/main/Microsoft.Network/privateEndpoints/deploy.bicep'`). Major benefits of this implementation are less code duplication, more consistency throughout the module library and allowing the consumer to leverage the full interface provided by the referenced module.
> **Note**: Cross-referencing modules from the local repository creates a dependency for the modules applying this technique on the referenced modules being part of the local repository. Reusing the example from above, the Key Vault module has a dependency on the referenced Private Endpoint module, meaning that the repository from which the Key Vault module is deployed also requires the Private Endpoint module to be present. For this reason, we provide a utility to check for any local module references in a given path. This can be useful to determine which module folders you'd need if you don't want to keep the entire library. For further information on how to use the tool, please refer to the tool-specific [documentation](./Getting%20started%20-%20Get%20module%20cross-references).

### Deployment names
Expand All @@ -469,7 +484,9 @@ While exceptions might be needed, the following guidance should be followed as m
...
}]
```

> **Example**: for the `roleAssignment` deployment in the Key Vault `secrets` template
>
> ```
> module secret_roleAssignments '.bicep/nested_roleAssignments.bicep' = [for (roleAssignment, index) in roleAssignments: {
> name: '${deployment().name}-Rbac-${index}'
Expand All @@ -480,7 +497,9 @@ While exceptions might be needed, the following guidance should be followed as m
```
'${uniqueString(deployment().name, location)}-<topLevelResourceType>-<referencedResourceType>'
```

> **Example**: for the `tableServices` deployment inside the `storageAccount` template
>
> ```
> name: '${uniqueString(deployment().name, location)}-Storage-TableServices'
> ```
Expand All @@ -490,7 +509,9 @@ While exceptions might be needed, the following guidance should be followed as m
```
'${deployment().name}-<referencedResourceType>[-${index}]'
```

> **Example**: for the `tables` deployment in the `tableServices` template
>
> ```
> name: '${deployment().name}-Table-${index}'
> ```
Expand All @@ -512,6 +533,7 @@ While exceptions might be needed, the following guidance should be followed as m

Each module must come with a ReadMe Markdown file that outlines what the module contains and 'how' it can be used.
Its primary components are in order:

- A title with a reference to the primary resource in Start Case followed by the primary resource namespace e.g., <code>Key Vaults `[Microsoft.KeyVault/vaults]`</code>.
- A short description
- A **Resource types** section with a table that outlines all resources that can be deployed as part of the module.
Expand All @@ -521,23 +543,27 @@ Its primary components are in order:
- A **Template references** section listing relevant resources [Azure resource reference](https://docs.microsoft.com/en-us/azure/templates).

Note the following recommendations:

- Refer to [Generate module Readme](./Contribution%20guide%20-%20Generate%20module%20Readme) for creating from scratch or updating the module ReadMe Markdown file.
- It is not recommended to describe how to use child resources in the parent readme file (for example, 'How to define a \[container] entry for the \[storage account]'). Instead, it is recommended to reference the child resource's ReadMe (for example, 'container/readme.md').

# Module test files

Module test files in CARML are implemented in

- a classic way leveraging the common `deploymentParameters.json` schema for ARM deployments or
- using comprehensive `.bicep` test files that not only test the module's template in a certain scenario, but also deploy any required dependency for it. All classic test files will be migrated to this module following the issue [1583](https://github.com/Azure/ResourceModules/issues/1583).

As parameters are usually specific to their corresponding template, we only have a few general recommendations:
In either case, we follow the following, general guidelines:

- A module should have as many module test files as it needs to evaluate all parts of the module's functionality.
- Sensitive data should not be stored inside the module test file but rather be injected by the use of tokens, as described in the [Token replacement](./The%20CI%20environment%20-%20Token%20replacement) section, or via a [Key Vault reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/key-vault-parameter?tabs=azure-cli#reference-secrets-with-static-id).

- JSON Parameter File specific
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved
- Parameter file names should ideally relate to the content they deploy. For example, a parameter file `min.parameters.json` should be chosen for a parameter file that contains only the minimum set of parameters to deploy the module.
- Likewise, the `name` parameter we have in most modules should give some indication of the file it was deployed with. For example, a `min.parameters.json` parameter file for the virtual network module may have a `name` property with the value `sxx-az-vnet-min-001` where `min` relates to the prefix of the parameter file itself.
- Bicep File specific
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved

- Each scenario should be setup in its own sub-folder (e.g. `.test/linux`)
- Each folder should contain at least a file `deploy.test.bicep` and optionally an additional `dependencies.bicep` file. The `deploy.test.bicep` file should deploy any immediate dependencies (e.g. a resource group, if required) and invoke the module's main template while providing all parameters for a given test scenario. The `dependencies.bicep` should optionally be used if any additional dependencies must be deployed into a nested scope (e.g. into a deployed resource group).
- Parameters
Expand Down Expand Up @@ -627,13 +653,15 @@ As parameters are usually specific to their corresponding template, we only have
}
}
```

</details>

# Telemetry

Each module in CARML contains a `defaultTelemetry` deployment `'pid-<GUID>-${uniqueString(deployment().name)}'`, resulting in deployments such as `'pid-<GUID>-nx2c3rnlt2wru'`.
Each module in CARML contains a `defaultTelemetry` deployment `'pid-<GUID>-${uniqueString(deployment().name)}'`, resulting in deployments such as `'pid-<GUID>-nx2c3rnlt2wru'`.

> **Note:** Though implemented at each level in a module hierarchy (e.g., storage account & blobServices), the deployment will only happen for the top-level module in a deployment, but not for its children. To illustrate this better, see the following examples:
>
> - Deployment of the KeyVault module and 2 Secrets: Results in 1 `PID` deployment for the KeyVault (and none for the secrets)
> - Deployment of the Secret module: Results in 1 `PID` deployment for the Secret

Expand All @@ -642,6 +670,7 @@ This resource enables the CARML product team to query the number of deployments
When using CARML's CI environment you can enable/disable this deployment by switching the `enableDefaultTelemetry` setting in the `settings.yml` file in the repository's root. This value is automatically injected into each individual deployment that is performed as part of the environment's pipeline.

When consuming the modules outside of CARML's pipelines you can either

- Set the parameter to a default value of `'false'`
- Set the parameter to false when deploying a module

Expand Down