Skip to content

Commit

Permalink
Adding tags parameters with radapp defaults to Azure Recipes (#60)
Browse files Browse the repository at this point in the history
* Adding tags parameters with radapp defaults to Azure Recipes

Signed-off-by: Will Velida <[email protected]>

* Add radius-specific tags with optional tag parameters. null checking on application context in tag

Signed-off-by: Will Velida <[email protected]>

* Adding hyphen character in radiusTags object

Signed-off-by: Will Velida <[email protected]>

---------

Signed-off-by: Will Velida <[email protected]>
  • Loading branch information
willvelida committed Feb 21, 2024
1 parent 2fb4c8c commit 6be2c36
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
11 changes: 11 additions & 0 deletions azure/extender-servicebus.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,20 @@ param skuTier string = 'Standard'
@description('ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.')
param defaultMessageTimeToLive string = 'P14D'

@description('The user-defined tags that will be applied to the resource. Default is null')
param tags object = {}

@description('The Radius specific tags that will be applied to the resource')
var radiusTags = {
'radapp.io-environment': context.environment.id
'radapp.io-application': context.application == null ? '' : context.application.id
'radapp.io-resource': context.resource.id
}

resource servicebus 'Microsoft.ServiceBus/namespaces@2021-06-01-preview' = {
name: 'servicebus-namespace-${uniqueString(context.resource.id, resourceGroup().id)}'
location: location
tags: union(radiusTags, tags)
sku: {
name: skuName
tier: skuTier
Expand Down
11 changes: 11 additions & 0 deletions azure/rediscaches.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,20 @@ param skuFamily string = 'C'
])
param skuName string = 'Basic'

@description('The user-defined tags that will be applied to the resource. Default is null')
param tags object = {}

@description('The Radius specific tags that will be applied to the resource')
var radiusTags = {
'radapp.io-environment': context.environment.id
'radapp.io-application': context.application == null ? '' : context.application.id
'radapp.io-resource': context.resource.id
}

resource azureCache 'Microsoft.Cache/redis@2022-06-01' = {
name: 'cache-${uniqueString(context.resource.id, resourceGroup().id)}'
location: location
tags: union(tags, radiusTags)
properties: {
sku: {
capacity: skuCapacity
Expand Down
12 changes: 12 additions & 0 deletions azure/sqldatabases.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,22 @@ param skuName string = 'Standard'
])
param skuTier string = 'Standard'

@description('The user-defined tags that will be applied to the resource. Default is null')
param tags object = {}

@description('The Radius specific tags that will be applied to the resource')
var radiusTags = {
'radapp.io-environment': context.environment.id
'radapp.io-application': context.application == null ? '' : context.application.id
'radapp.io-resource': context.resource.id
}

var mssqlPort = 1433

resource mssql 'Microsoft.Sql/servers@2021-02-01-preview' = {
name: '${context.resource.name}-${uniqueString(context.resource.id, resourceGroup().id)}'
location: location
tags: union(tags, radiusTags)
properties: {
administratorLogin: adminLogin
administratorLoginPassword: adminPassword
Expand All @@ -67,6 +78,7 @@ resource mssql 'Microsoft.Sql/servers@2021-02-01-preview' = {
resource db 'databases' = {
name: database
location: location
tags: union(tags, radiusTags)
sku: {
name: skuName
tier: skuTier
Expand Down
11 changes: 11 additions & 0 deletions azure/statestores.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,20 @@ param actorStateStore bool = false
@description('The name of the container to create within the Azure storage account and to reference within the Dapr component.')
var containerName = context.resource.name

@description('The user-defined tags that will be applied to the resource. Default is null')
param tags object = {}

@description('The Radius specific tags that will be applied to the resource')
var radiusTags = {
'radapp.io-environment': context.environment.id
'radapp.io-application': context.application == null ? '' : context.application.id
'radapp.io-resource': context.resource.id
}

resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: 'recipe${uniqueString(context.resource.id, resourceGroup().id)}'
location: location
tags: union(tags, radiusTags)
sku: {
name: 'Standard_ZRS'
}
Expand Down

0 comments on commit 6be2c36

Please sign in to comment.