Skip to content

Commit

Permalink
fix: static validation + added common types in `avm/res/service-netwo…
Browse files Browse the repository at this point in the history
…rking/traffic-controller` (#3758)

## Description

Fixes #3702

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.res.service-networking.traffic-controller](https://github.com/krbar/bicep-registry-modules/actions/workflows/avm.res.service-networking.traffic-controller.yml/badge.svg?branch=users%2Fkrbar%2FtrafficControllerFix)](https://github.com/krbar/bicep-registry-modules/actions/workflows/avm.res.service-networking.traffic-controller.yml)
|

## Type of Change

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

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [x] Azure Verified Module updates:
- [x] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [x] 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 date with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
  • Loading branch information
krbar authored Nov 8, 2024
1 parent 8237a35 commit 7e8e250
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 334 deletions.
18 changes: 14 additions & 4 deletions avm/res/service-networking/traffic-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This module deploys an Application Gateway for Containers
- [Usage examples](#Usage-examples)
- [Parameters](#Parameters)
- [Outputs](#Outputs)
- [Cross-referenced modules](#Cross-referenced-modules)
- [Notes](#Notes)
- [Data Collection](#Data-Collection)

Expand Down Expand Up @@ -512,7 +513,7 @@ param tags = {
| [`enableTelemetry`](#parameter-enabletelemetry) | bool | Enable/Disable usage telemetry for module. |
| [`frontends`](#parameter-frontends) | array | List of Application Gateway for Containers frontends. |
| [`location`](#parameter-location) | string | Location for all Resources. |
| [`lock`](#parameter-lock) | object | The lock settings of the service. |
| [`lock`](#parameter-lock) | object | The lock settings for all Resources in the solution. |
| [`roleAssignments`](#parameter-roleassignments) | array | Array of role assignments to create. |
| [`tags`](#parameter-tags) | object | Resource tags. |

Expand Down Expand Up @@ -568,7 +569,7 @@ The diagnostic settings of the service.
| [`logCategoriesAndGroups`](#parameter-diagnosticsettingslogcategoriesandgroups) | array | The name of logs that will be streamed. "allLogs" includes all possible logs for the resource. Set to `[]` to disable log collection. |
| [`marketplacePartnerResourceId`](#parameter-diagnosticsettingsmarketplacepartnerresourceid) | string | The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. |
| [`metricCategories`](#parameter-diagnosticsettingsmetriccategories) | array | The name of metrics that will be streamed. "allMetrics" includes all possible metrics for the resource. Set to `[]` to disable metric collection. |
| [`name`](#parameter-diagnosticsettingsname) | string | The name of diagnostic setting. |
| [`name`](#parameter-diagnosticsettingsname) | string | The name of the diagnostic setting. |
| [`storageAccountResourceId`](#parameter-diagnosticsettingsstorageaccountresourceid) | string | Resource ID of the diagnostic storage account. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub. |
| [`workspaceResourceId`](#parameter-diagnosticsettingsworkspaceresourceid) | string | Resource ID of the diagnostic log analytics workspace. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub. |

Expand Down Expand Up @@ -678,7 +679,7 @@ Enable or disable the category explicitly. Default is `true`.

### Parameter: `diagnosticSettings.name`

The name of diagnostic setting.
The name of the diagnostic setting.

- Required: No
- Type: string
Expand Down Expand Up @@ -735,7 +736,7 @@ Location for all Resources.

### Parameter: `lock`

The lock settings of the service.
The lock settings for all Resources in the solution.

- Required: No
- Type: object
Expand Down Expand Up @@ -891,6 +892,15 @@ Resource tags.
| `resourceGroupName` | string | The name of the resource group the resource was created in. |
| `resourceId` | string | The resource ID of the Application Gateway for Containers. |

## Cross-referenced modules

This section gives you an overview of all local-referenced module files (i.e., other modules that are referenced in this module) and all remote-referenced files (i.e., Bicep modules that are referenced from a Bicep Registry or Template Specs).

| Reference | Type |
| :-- | :-- |
| `br/public:avm/utl/types/avm-common-types:0.2.1` | Remote reference |
| `br/public:avm/utl/types/avm-common-types:0.3.0` | Remote reference |

## Notes

> **Limitation**: At this time, the number of associations is limited to 1 (Source: [Application Gateway for Containers associations](https://learn.microsoft.com/en-us/azure/application-gateway/for-containers/application-gateway-for-containers-components#application-gateway-for-containers-associations))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This module deploys an Application Gateway for Containers Association
| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`name`](#parameter-name) | string | Name of the association to create. |
| [`subnetResourceId`](#parameter-subnetresourceid) | string | The resource ID of the subnet to associate with the traffic controller. |

**Conditional parameters**

Expand All @@ -34,19 +35,20 @@ This module deploys an Application Gateway for Containers Association
| :-- | :-- | :-- |
| [`location`](#parameter-location) | string | Location for all Resources. |

**Reuired parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`subnetResourceId`](#parameter-subnetresourceid) | string | The resource ID of the subnet to associate with the traffic controller. |

### Parameter: `name`

Name of the association to create.

- Required: Yes
- Type: string

### Parameter: `subnetResourceId`

The resource ID of the subnet to associate with the traffic controller.

- Required: Yes
- Type: string

### Parameter: `trafficControllerName`

The name of the parent Application Gateway for Containers instance. Required if the template is used in a standalone deployment.
Expand All @@ -62,13 +64,6 @@ Location for all Resources.
- Type: string
- Default: `[resourceGroup().location]`

### Parameter: `subnetResourceId`

The resource ID of the subnet to associate with the traffic controller.

- Required: Yes
- Type: string

## Outputs

| Output | Type | Description |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ param location string = resourceGroup().location
@description('Conditional. The name of the parent Application Gateway for Containers instance. Required if the template is used in a standalone deployment.')
param trafficControllerName string

@description('Reuired. The resource ID of the subnet to associate with the traffic controller.')
@description('Required. The resource ID of the subnet to associate with the traffic controller.')
param subnetResourceId string

// ============== //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.30.23.60470",
"templateHash": "17751059838446450774"
"version": "0.31.34.60546",
"templateHash": "16237699923821445314"
},
"name": "Application Gateway for Containers Association",
"description": "This module deploys an Application Gateway for Containers Association",
Expand Down Expand Up @@ -34,7 +34,7 @@
"subnetResourceId": {
"type": "string",
"metadata": {
"description": "Reuired. The resource ID of the subnet to associate with the traffic controller."
"description": "Required. The resource ID of the subnet to associate with the traffic controller."
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.30.23.60470",
"templateHash": "12093954076612099884"
"version": "0.31.34.60546",
"templateHash": "12126990142824202083"
},
"name": "Application Gateway for Containers Frontend",
"description": "This module deploys an Application Gateway for Containers Frontend",
Expand Down
101 changes: 14 additions & 87 deletions avm/res/service-networking/traffic-controller/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ param enableTelemetry bool = true
@description('Optional. Resource tags.')
param tags object?

@description('Optional. The lock settings of the service.')
param lock lockType
import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.3.0'
@description('Optional. The lock settings for all Resources in the solution.')
param lock lockType?

import { diagnosticSettingFullType } from 'br/public:avm/utl/types/avm-common-types:0.3.0'
@description('Optional. The diagnostic settings of the service.')
param diagnosticSettings diagnosticSettingType
param diagnosticSettings diagnosticSettingFullType[]?

import { roleAssignmentType } from 'br/public:avm/utl/types/avm-common-types:0.2.1'
@description('Optional. Array of role assignments to create.')
param roleAssignments roleAssignmentType
param roleAssignments roleAssignmentType[]?

@description('Optional. List of Application Gateway for Containers frontends.')
param frontends frontendType
param frontends frontendType[]?

@maxLength(1)
@description('Optional. List of Application Gateway for Containers associations. At this time, the number of associations is limited to 1.')
param associations associationType
param associations associationType[]?

var builtInRoleNames = {
Contributor: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')
Expand Down Expand Up @@ -208,94 +212,17 @@ output associations array = [
// Definitions //
// ================ //

@export()
type frontendType = {
@description('Required. The name of the Application Gateway for Containers frontend.')
name: string
}[]?
}

@maxLength(1)
@export()
type associationType = {
@description('Required. The name of the Application Gateway for Containers association.')
name: string

@description('Required. The resource ID of the subnet to associate with the Application Gateway for Containers.')
subnetResourceId: string
}[]?

type lockType = {
@description('Optional. Specify the name of lock.')
name: string?

@description('Optional. Specify the type of lock.')
kind: ('CanNotDelete' | 'ReadOnly' | 'None')?
}?

type roleAssignmentType = {
@description('Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated.')
name: string?

@description('Required. The role to assign. You can provide either the display name of the role definition, the role definition GUID, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
roleDefinitionIdOrName: string

@description('Required. The principal ID of the principal (user/group/identity) to assign the role to.')
principalId: string

@description('Optional. The principal type of the assigned principal ID.')
principalType: ('ServicePrincipal' | 'Group' | 'User' | 'ForeignGroup' | 'Device')?

@description('Optional. The description of the role assignment.')
description: string?

@description('Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase "foo_storage_container".')
condition: string?

@description('Optional. Version of the condition.')
conditionVersion: '2.0'?

@description('Optional. The Resource Id of the delegated managed identity resource.')
delegatedManagedIdentityResourceId: string?
}[]?

type diagnosticSettingType = {
@description('Optional. The name of diagnostic setting.')
name: string?

@description('Optional. The name of logs that will be streamed. "allLogs" includes all possible logs for the resource. Set to `[]` to disable log collection.')
logCategoriesAndGroups: {
@description('Optional. Name of a Diagnostic Log category for a resource type this setting is applied to. Set the specific logs to collect here.')
category: string?

@description('Optional. Name of a Diagnostic Log category group for a resource type this setting is applied to. Set to `allLogs` to collect all logs.')
categoryGroup: string?

@description('Optional. Enable or disable the category explicitly. Default is `true`.')
enabled: bool?
}[]?

@description('Optional. The name of metrics that will be streamed. "allMetrics" includes all possible metrics for the resource. Set to `[]` to disable metric collection.')
metricCategories: {
@description('Required. Name of a Diagnostic Metric category for a resource type this setting is applied to. Set to `AllMetrics` to collect all metrics.')
category: string

@description('Optional. Enable or disable the category explicitly. Default is `true`.')
enabled: bool?
}[]?

@description('Optional. A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type.')
logAnalyticsDestinationType: ('Dedicated' | 'AzureDiagnostics')?

@description('Optional. Resource ID of the diagnostic log analytics workspace. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
workspaceResourceId: string?

@description('Optional. Resource ID of the diagnostic storage account. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
storageAccountResourceId: string?

@description('Optional. Resource ID of the diagnostic event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to.')
eventHubAuthorizationRuleResourceId: string?

@description('Optional. Name of the diagnostic event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
eventHubName: string?

@description('Optional. The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs.')
marketplacePartnerResourceId: string?
}[]?
}
Loading

0 comments on commit 7e8e250

Please sign in to comment.