Skip to content

Commit

Permalink
feat: avm/res/sql/instance-pool (#1714)
Browse files Browse the repository at this point in the history
## Description

This PR adds the new Azure SQL Instance pool and its tests

Closes [Module Proposal : avm/res/sql/instance-pool](#752)

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.res.sql.instance-pool](https://github.com/yashints/bicep-registry-modules/actions/workflows/avm.res.sql.instance-pool.yml/badge.svg)](https://github.com/yashints/bicep-registry-modules/actions/workflows/avm.res.sql.instance-pool.yml)
|

## Type of Change

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

- [ ] Update to CI Environment or utlities (Non-module effecting
changes)
- [x] 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.
- [ ] 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 day with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
  • Loading branch information
yashints authored Apr 23, 2024
1 parent 1dd8628 commit 9fc5074
Show file tree
Hide file tree
Showing 11 changed files with 1,354 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
/avm/res/service-fabric/cluster/ @Azure/avm-res-servicefabric-cluster-module-owners-bicep @Azure/avm-core-team-technical-bicep
/avm/res/signal-r-service/signal-r/ @Azure/avm-res-signalrservice-signalr-module-owners-bicep @Azure/avm-core-team-technical-bicep
/avm/res/signal-r-service/web-pub-sub/ @Azure/avm-res-signalrservice-webpubsub-module-owners-bicep @Azure/avm-core-team-technical-bicep
/avm/res/sql/instance-pool/ @Azure/avm-res-sql-instancepool-module-owners-bicep @Azure/avm-core-team-technical-bicep
/avm/res/sql/managed-instance/ @Azure/avm-res-sql-managedinstance-module-owners-bicep @Azure/avm-core-team-technical-bicep
/avm/res/sql/server/ @Azure/avm-res-sql-server-module-owners-bicep @Azure/avm-core-team-technical-bicep
/avm/res/storage/storage-account/ @Azure/avm-res-storage-storageaccount-module-owners-bicep @Azure/avm-core-team-technical-bicep
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/avm_module_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ body:
- "avm/res/service-fabric/cluster"
- "avm/res/signal-r-service/signal-r"
- "avm/res/signal-r-service/web-pub-sub"
- "avm/res/sql/instance-pool"
- "avm/res/sql/managed-instance"
- "avm/res/sql/server"
- "avm/res/storage/storage-account"
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/avm.res.sql.instance-pool.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: "avm.res.sql.instance-pool"

on:
schedule:
- cron: "0 12 1/15 * *" # Bi-Weekly Test (on 1st & 15th of month)
workflow_dispatch:
inputs:
staticValidation:
type: boolean
description: "Execute static validation"
required: false
default: true
deploymentValidation:
type: boolean
description: "Execute deployment validation"
required: false
default: true
removeDeployment:
type: boolean
description: "Remove deployed module"
required: false
default: false
push:
branches:
- main
paths:
- ".github/actions/templates/avm-**"
- ".github/workflows/avm.template.module.yml"
- ".github/workflows/avm.res.sql.instance-pool.yml"
- "avm/res/sql/instance-pool/**"
- "avm/utilities/pipelines/**"
- "!avm/utilities/pipelines/platform/**"
- "!*/**/README.md"

env:
modulePath: "avm/res/sql/instance-pool"
workflowPath: ".github/workflows/avm.res.sql.instance-pool.yml"

concurrency:
group: ${{ github.workflow }}

jobs:
###########################
# Initialize pipeline #
###########################
job_initialize_pipeline:
runs-on: ubuntu-latest
name: "Initialize pipeline"
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Set input parameters to output variables"
id: get-workflow-param
uses: ./.github/actions/templates/avm-getWorkflowInput
with:
workflowPath: "${{ env.workflowPath}}"
- name: "Get module test file paths"
id: get-module-test-file-paths
uses: ./.github/actions/templates/avm-getModuleTestFiles
with:
modulePath: "${{ env.modulePath }}"
outputs:
workflowInput: ${{ steps.get-workflow-param.outputs.workflowInput }}
moduleTestFilePaths: ${{ steps.get-module-test-file-paths.outputs.moduleTestFilePaths }}
psRuleModuleTestFilePaths: ${{ steps.get-module-test-file-paths.outputs.psRuleModuleTestFilePaths }}
modulePath: "${{ env.modulePath }}"

##############################
# Call reusable workflow #
##############################
call-workflow-passing-data:
name: "Run"
permissions:
id-token: write # For OIDC
contents: write # For release tags
needs:
- job_initialize_pipeline
uses: ./.github/workflows/avm.template.module.yml
with:
workflowInput: "${{ needs.job_initialize_pipeline.outputs.workflowInput }}"
moduleTestFilePaths: "${{ needs.job_initialize_pipeline.outputs.moduleTestFilePaths }}"
psRuleModuleTestFilePaths: "${{ needs.job_initialize_pipeline.outputs.psRuleModuleTestFilePaths }}"
modulePath: "${{ needs.job_initialize_pipeline.outputs.modulePath}}"
secrets: inherit
286 changes: 286 additions & 0 deletions avm/res/sql/instance-pool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
# SQL Server Instance Pool `[Microsoft.Sql/instancePools]`

This module deploys an Azure SQL Server Instance Pool.

## Navigation

- [Resource Types](#Resource-Types)
- [Usage examples](#Usage-examples)
- [Parameters](#Parameters)
- [Outputs](#Outputs)
- [Cross-referenced modules](#Cross-referenced-modules)
- [Data Collection](#Data-Collection)

## Resource Types

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Sql/instancePools` | [2023-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2023-05-01-preview/instancePools) |

## Usage examples

The following section provides usage examples for the module, which were used to validate and deploy the module successfully. For a full reference, please review the module's test folder in its repository.

>**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order.
>**Note**: To reference the module, please use the following syntax `br/public:avm/res/sql/instance-pool:<version>`.
- [Using only defaults](#example-1-using-only-defaults)
- [WAF-aligned](#example-2-waf-aligned)

### Example 1: _Using only defaults_

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


<details>

<summary>via Bicep module</summary>

```bicep
module instancePool 'br/public:avm/res/sql/instance-pool:<version>' = {
name: 'instancePoolDeployment'
params: {
// Required parameters
name: '<name>'
subnetResourceId: '<subnetResourceId>'
// Non-required parameters
location: '<location>'
}
}
```

</details>
<p>

<details>

<summary>via JSON Parameter file</summary>

```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"name": {
"value": "<name>"
},
"subnetResourceId": {
"value": "<subnetResourceId>"
},
// Non-required parameters
"location": {
"value": "<location>"
}
}
}
```

</details>
<p>

### Example 2: _WAF-aligned_

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


<details>

<summary>via Bicep module</summary>

```bicep
module instancePool 'br/public:avm/res/sql/instance-pool:<version>' = {
name: 'instancePoolDeployment'
params: {
// Required parameters
name: '<name>'
subnetResourceId: '<subnetResourceId>'
// Non-required parameters
location: '<location>'
skuName: 'GP_Gen8IM'
}
}
```

</details>
<p>

<details>

<summary>via JSON Parameter file</summary>

```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"name": {
"value": "<name>"
},
"subnetResourceId": {
"value": "<subnetResourceId>"
},
// Non-required parameters
"location": {
"value": "<location>"
},
"skuName": {
"value": "GP_Gen8IM"
}
}
}
```

</details>
<p>


## Parameters

**Required parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`name`](#parameter-name) | string | The name of the instance pool. |
| [`subnetResourceId`](#parameter-subnetresourceid) | string | The subnet resource ID for the instance pool. |

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`enableTelemetry`](#parameter-enabletelemetry) | bool | Enable/Disable usage telemetry for module. |
| [`licenseType`](#parameter-licensetype) | string | The license type to apply for this database. |
| [`location`](#parameter-location) | string | Location for all resources. |
| [`skuFamily`](#parameter-skufamily) | string | If the service has different generations of hardware, for the same SKU, then that can be captured here. |
| [`skuName`](#parameter-skuname) | string | The SKU name for the instance pool. |
| [`tags`](#parameter-tags) | object | Tags of the resource. |
| [`tier`](#parameter-tier) | string | The vCore service tier for the instance pool. |
| [`vCores`](#parameter-vcores) | int | The number of vCores for the instance pool. |

### Parameter: `name`

The name of the instance pool.

- Required: Yes
- Type: string

### Parameter: `subnetResourceId`

The subnet resource ID for the instance pool.

- Required: Yes
- Type: string

### Parameter: `enableTelemetry`

Enable/Disable usage telemetry for module.

- Required: No
- Type: bool
- Default: `True`

### Parameter: `licenseType`

The license type to apply for this database.

- Required: No
- Type: string
- Default: `'BasePrice'`
- Allowed:
```Bicep
[
'BasePrice'
'LicenseIncluded'
]
```

### Parameter: `location`

Location for all resources.

- Required: No
- Type: string
- Default: `[resourceGroup().location]`

### Parameter: `skuFamily`

If the service has different generations of hardware, for the same SKU, then that can be captured here.

- Required: No
- Type: string
- Default: `'Gen5'`

### Parameter: `skuName`

The SKU name for the instance pool.

- Required: No
- Type: string
- Default: `'GP_Gen5'`

### Parameter: `tags`

Tags of the resource.

- Required: No
- Type: object

### Parameter: `tier`

The vCore service tier for the instance pool.

- Required: No
- Type: string
- Default: `'GeneralPurpose'`
- Allowed:
```Bicep
[
'GeneralPurpose'
]
```

### Parameter: `vCores`

The number of vCores for the instance pool.

- Required: No
- Type: int
- Default: `8`
- Allowed:
```Bicep
[
8
16
24
32
40
64
80
96
128
160
192
224
256
]
```


## Outputs

| Output | Type | Description |
| :-- | :-- | :-- |
| `instancePoolLocation` | string | The location of the SQL instance pool. |
| `name` | string | The name of the SQL instance pool. |
| `resourceGroupName` | string | The resource group name of the SQL instance pool. |
| `resourceId` | string | The ID of the SQL instance pool. |

## Cross-referenced modules

_None_

## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
Loading

0 comments on commit 9fc5074

Please sign in to comment.