Skip to content

Commit

Permalink
feat: Service-Bus-Namespace - Adding rules for subscriptions (#4106)
Browse files Browse the repository at this point in the history
## Description

Rebase of #3558

> Original description
> Adding rules for subscriptions in avm/res/service-bus/namespace

## Pipeline Reference

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

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

[![avm.res.service-bus.namespace](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.service-bus.namespace.yml/badge.svg?branch=users%2Falsehr%2Ftimdhaeyer-addRules_rebase&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.service-bus.namespace.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:
- [ ] 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

---------

Co-authored-by: Tim D'haeyer <timdhaeyer@zure.com>
Co-authored-by: Tim D'haeyer <47555315+timdhaeyer@users.noreply.github.com>
Co-authored-by: ChrisSidebotham-MSFT <48600046+ChrisSidebotham@users.noreply.github.com>
Co-authored-by: Benjamin P. Jung <b.jung@qvest-digital.com>
Co-authored-by: Benjamin P. Jung <headcr4sh@gmail.com>
  • Loading branch information
6 people authored Jan 16, 2025
1 parent 4bb53e6 commit 3eceecc
Show file tree
Hide file tree
Showing 20 changed files with 2,864 additions and 126 deletions.
275 changes: 254 additions & 21 deletions avm/res/service-bus/namespace/README.md

Large diffs are not rendered by default.

35 changes: 25 additions & 10 deletions avm/res/service-bus/namespace/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ param authorizationRules authorizationRuleType[] = [
]

@description('Optional. The migration configuration.')
param migrationConfiguration migrationConfigurationsType?
param migrationConfiguration migrationConfigurationType?

@description('Optional. The disaster recovery configuration.')
param disasterRecoveryConfig disasterRecoveryConfigType?

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

import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.4.0'
import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
@description('Optional. The lock settings of the service.')
param lock lockType?

import { managedIdentityAllType } from 'br/public:avm/utl/types/avm-common-types:0.4.0'
import { managedIdentityAllType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
@description('Optional. The managed identity definition for this resource.')
param managedIdentities managedIdentityAllType?

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

Expand All @@ -75,7 +75,7 @@ param roleAssignments roleAssignmentType[]?
])
param publicNetworkAccess string = ''

import { privateEndpointSingleServiceType } from 'br/public:avm/utl/types/avm-common-types:0.4.0'
import { privateEndpointSingleServiceType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
@description('Optional. Configuration details for private endpoints. For security reasons, it is recommended to use private endpoints whenever possible.')
param privateEndpoints privateEndpointSingleServiceType[]?

Expand All @@ -97,7 +97,7 @@ param queues queueType[]?
@description('Optional. The topics to create in the service bus namespace.')
param topics topicType[]?

import { customerManagedKeyWithAutoRotateType } from 'br/public:avm/utl/types/avm-common-types:0.4.0'
import { customerManagedKeyWithAutoRotateType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
@description('Optional. The customer managed key definition.')
param customerManagedKey customerManagedKeyWithAutoRotateType?

Expand Down Expand Up @@ -259,7 +259,7 @@ module serviceBusNamespace_disasterRecoveryConfig 'disaster-recovery-config/main
}
}

module serviceBusNamespace_migrationConfigurations 'migration-configuration/main.bicep' = if (!empty(migrationConfiguration ?? {})) {
module serviceBusNamespace_migrationConfiguration 'migration-configuration/main.bicep' = if (!empty(migrationConfiguration ?? {})) {
name: '${uniqueString(deployment().name, location)}-MigrationConfigurations'
params: {
namespaceName: serviceBusNamespace.name
Expand Down Expand Up @@ -379,7 +379,15 @@ resource serviceBusNamespace_diagnosticSettings 'Microsoft.Insights/diagnosticSe
module serviceBusNamespace_privateEndpoints 'br/public:avm/res/network/private-endpoint:0.7.1' = [
for (privateEndpoint, index) in (privateEndpoints ?? []): {
name: '${uniqueString(deployment().name, location)}-serviceBusNamespace-PrivateEndpoint-${index}'
scope: resourceGroup(privateEndpoint.?resourceGroupName ?? '')
scope: !empty(privateEndpoint.?resourceGroupResourceId)
? resourceGroup(
split((privateEndpoint.?resourceGroupResourceId ?? '//'), '/')[2],
split((privateEndpoint.?resourceGroupResourceId ?? '////'), '/')[4]
)
: resourceGroup(
split((privateEndpoint.?subnetResourceId ?? '//'), '/')[2],
split((privateEndpoint.?subnetResourceId ?? '////'), '/')[4]
)
params: {
name: privateEndpoint.?name ?? 'pep-${last(split(serviceBusNamespace.id, '/'))}-${privateEndpoint.?service ?? 'namespace'}-${index}'
privateLinkServiceConnections: privateEndpoint.?isManualConnection != true
Expand Down Expand Up @@ -479,6 +487,7 @@ output privateEndpoints array = [
// =============== //

@export()
@description('The type for a SKU.')
type skuType = {
@description('Required. Name of this SKU. - Basic, Standard, Premium.')
name: ('Basic' | 'Standard' | 'Premium')
Expand All @@ -488,6 +497,7 @@ type skuType = {
}

@export()
@description('The type for an authorization rule.')
type authorizationRuleType = {
@description('Required. The name of the authorization rule.')
name: string
Expand All @@ -497,6 +507,7 @@ type authorizationRuleType = {
}

@export()
@description('The type for a disaster recovery configuration.')
type disasterRecoveryConfigType = {
@description('Optional. The name of the disaster recovery config.')
name: string?
Expand All @@ -509,7 +520,8 @@ type disasterRecoveryConfigType = {
}

@export()
type migrationConfigurationsType = {
@description('The type for a migration configuration')
type migrationConfigurationType = {
@description('Required. Name to access Standard Namespace after migration.')
postMigrationName: string

Expand All @@ -518,6 +530,7 @@ type migrationConfigurationsType = {
}

@export()
@description('The type for a network rule set.')
type networkRuleSetType = {
@description('Optional. This determines if traffic is allowed over public network. Default is "Enabled". If set to "Disabled", traffic to this namespace will be restricted over Private Endpoints only and network rules will not be applied.')
publicNetworkAccess: ('Disabled' | 'Enabled')?
Expand Down Expand Up @@ -548,6 +561,7 @@ type networkRuleSetType = {
}

@export()
@description('The type for a queue.')
type queueType = {
@description('Required. The name of the queue.')
name: string
Expand Down Expand Up @@ -621,6 +635,7 @@ type queueType = {

import { subscriptionType } from 'topic/main.bicep'
@export()
@description('The type for a topic.')
type topicType = {
@description('Required. The name of the topic.')
name: string
Expand Down
Loading

0 comments on commit 3eceecc

Please sign in to comment.