Skip to content

Commit

Permalink
feat: avm.res.service-fabric.cluster additional parameter validation (#…
Browse files Browse the repository at this point in the history
…3925)

## Description

Add a new test case to validate the clientCertificateThumbprints and
sCertificateCommonNames parameters together. A new test case was
required as this parameter combination could not be used with parameter
sets in the other test cases. Also converted all instances of the
"contains" keyword to use the safe access operator.

Closes #2346

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |

[![avm.res.service-fabric.cluster](https://github.com/lsnoddy/bicep-registry-modules/actions/workflows/avm.res.service-fabric.cluster.yml/badge.svg?branch=users%2Flsnoddy%2Fservice-fabric-cluster-testcase)](https://github.com/lsnoddy/bicep-registry-modules/actions/workflows/avm.res.service-fabric.cluster.yml)
|          |

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [ ] Azure Verified Module updates:
- [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [x] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ ] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to date with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
  • Loading branch information
lsnoddy authored Dec 21, 2024
1 parent af33cdb commit 1c8d1c2
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 142 deletions.
189 changes: 183 additions & 6 deletions avm/res/service-fabric/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,188 @@ The following section provides usage examples for the module, which were used to
>**Note**: To reference the module, please use the following syntax `br/public:avm/res/service-fabric/cluster:<version>`.
- [Using only defaults](#example-1-using-only-defaults)
- [Using large parameter set](#example-2-using-large-parameter-set)
- [WAF-aligned](#example-3-waf-aligned)
- [Using client and server certificate parameter set](#example-1-using-client-and-server-certificate-parameter-set)
- [Using only defaults](#example-2-using-only-defaults)
- [Using large parameter set](#example-3-using-large-parameter-set)
- [WAF-aligned](#example-4-waf-aligned)

### Example 1: _Using only defaults_
### Example 1: _Using client and server certificate parameter set_

This instance deploys the module with client and server certificates using thumbprints and common names.


<details>

<summary>via Bicep module</summary>

```bicep
module cluster 'br/public:avm/res/service-fabric/cluster:<version>' = {
name: 'clusterDeployment'
params: {
// Required parameters
managementEndpoint: 'https://sfccrt001.westeurope.cloudapp.azure.com:19080'
name: 'sfccrt001'
nodeTypes: [
{
applicationPorts: {
endPort: 30000
startPort: 20000
}
clientConnectionEndpointPort: 19000
durabilityLevel: 'Bronze'
ephemeralPorts: {
endPort: 65534
startPort: 49152
}
httpGatewayEndpointPort: 19080
isPrimary: true
name: 'Node01'
}
]
reliabilityLevel: 'None'
// Non-required parameters
certificateCommonNames: {
commonNames: [
{
certificateCommonName: 'certcommon'
certificateIssuerThumbprint: '0AC113D5E1D94C401DDEB0EE2B1B96CC130'
}
]
x509StoreName: 'My'
}
clientCertificateThumbprints: [
{
certificateThumbprint: 'D945B0AC4BDF78D31FB6F09CF375E0B9DC7BBBBE'
isAdmin: true
}
]
location: '<location>'
}
}
```

</details>
<p>

<details>

<summary>via JSON parameters file</summary>

```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"managementEndpoint": {
"value": "https://sfccrt001.westeurope.cloudapp.azure.com:19080"
},
"name": {
"value": "sfccrt001"
},
"nodeTypes": {
"value": [
{
"applicationPorts": {
"endPort": 30000,
"startPort": 20000
},
"clientConnectionEndpointPort": 19000,
"durabilityLevel": "Bronze",
"ephemeralPorts": {
"endPort": 65534,
"startPort": 49152
},
"httpGatewayEndpointPort": 19080,
"isPrimary": true,
"name": "Node01"
}
]
},
"reliabilityLevel": {
"value": "None"
},
// Non-required parameters
"certificateCommonNames": {
"value": {
"commonNames": [
{
"certificateCommonName": "certcommon",
"certificateIssuerThumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130"
}
],
"x509StoreName": "My"
}
},
"clientCertificateThumbprints": {
"value": [
{
"certificateThumbprint": "D945B0AC4BDF78D31FB6F09CF375E0B9DC7BBBBE",
"isAdmin": true
}
]
},
"location": {
"value": "<location>"
}
}
}
```

</details>
<p>

<details>

<summary>via Bicep parameters file</summary>

```bicep-params
using 'br/public:avm/res/service-fabric/cluster:<version>'
// Required parameters
param managementEndpoint = 'https://sfccrt001.westeurope.cloudapp.azure.com:19080'
param name = 'sfccrt001'
param nodeTypes = [
{
applicationPorts: {
endPort: 30000
startPort: 20000
}
clientConnectionEndpointPort: 19000
durabilityLevel: 'Bronze'
ephemeralPorts: {
endPort: 65534
startPort: 49152
}
httpGatewayEndpointPort: 19080
isPrimary: true
name: 'Node01'
}
]
param reliabilityLevel = 'None'
// Non-required parameters
param certificateCommonNames = {
commonNames: [
{
certificateCommonName: 'certcommon'
certificateIssuerThumbprint: '0AC113D5E1D94C401DDEB0EE2B1B96CC130'
}
]
x509StoreName: 'My'
}
param clientCertificateThumbprints = [
{
certificateThumbprint: 'D945B0AC4BDF78D31FB6F09CF375E0B9DC7BBBBE'
isAdmin: true
}
]
param location = '<location>'
```

</details>
<p>

### Example 2: _Using only defaults_

This instance deploys the module with the minimum set of required parameters.

Expand Down Expand Up @@ -169,7 +346,7 @@ param location = '<location>'
</details>
<p>

### Example 2: _Using large parameter set_
### Example 3: _Using large parameter set_

This instance deploys the module with most of its features enabled.

Expand Down Expand Up @@ -768,7 +945,7 @@ param vmImage = 'Linux'
</details>
<p>

### Example 3: _WAF-aligned_
### Example 4: _WAF-aligned_

This instance deploys the module in alignment with the best-practices of the Azure Well-Architected Framework.

Expand Down
9 changes: 3 additions & 6 deletions avm/res/service-fabric/cluster/application-type/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "8632559494589711330"
"version": "0.32.4.45862",
"templateHash": "4770865885039578272"
},
"name": "Service Fabric Cluster Application Types",
"description": "This module deploys a Service Fabric Cluster Application Type.",
Expand Down Expand Up @@ -45,10 +45,7 @@
"type": "Microsoft.ServiceFabric/clusters/applicationTypes",
"apiVersion": "2021-06-01",
"name": "[format('{0}/{1}', parameters('serviceFabricClusterName'), parameters('name'))]",
"tags": "[parameters('tags')]",
"dependsOn": [
"serviceFabricCluster"
]
"tags": "[parameters('tags')]"
}
},
"outputs": {
Expand Down
Loading

0 comments on commit 1c8d1c2

Please sign in to comment.