Skip to content

Commit

Permalink
AVM Module Updates (#22)
Browse files Browse the repository at this point in the history
Updating code for AVM module references from old public registry
  • Loading branch information
riosengineer authored Aug 10, 2024
1 parent ac6e992 commit 16dbe53
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 18 deletions.
4 changes: 2 additions & 2 deletions bicep-examples/conditions/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ param kvEnv string = 'prod'
// Environment variable for Key Vault SKU else if
var kvSku = kvEnv == 'prod' ? 'premium' : 'standard'

module KeyVault 'br/public:security/keyvault:1.0.2' = if (deployResource) {
module KeyVault 'br/public:avm/res/key-vault/vault:0.7.0' = if (deployResource) {
name: '${uniqueString(deployment().name, location)}-${kvName}'
params: {
name: kvName
location: location
skuName: kvSku
sku: kvSku
enableSoftDelete: true
}
}
Expand Down
12 changes: 6 additions & 6 deletions bicep-examples/consuming-modules/modules.bicep
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Rios Engineer - Public Bicep Registry Example
module public_registry 'br/public:compute/function-app:2.0.1' = {
name: 'public_registry_example'
// Rios Engineer - Public Bicep Registry Example (Azure Verified Modules)
module KeyVault 'br/public:avm/res/key-vault/vault:0.7.0' = {
name: 'avm_exmple'
params: {
name: 'example-func-001'
name: 'kvName'
location: 'uksouth'
storageAccountName: 'stsomestorageaccount001'
storageAccountResourceGroup: 'rg-some-rg-here'
sku: 'standard'
enableSoftDelete: true
}
}

Expand Down
6 changes: 3 additions & 3 deletions bicep-examples/dependencies/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var frontDoorRouteName = 'webapp-route'
// Azure App Service components

// vNet for integration
module vnet 'br/public:network/virtual-network:1.1.3' = {
module vnet 'br/public:avm/res/network/virtual-network:0.2.0' = {
name: '${uniqueString(deployment().name, location)}-webVnet'
scope: resourceGroup(workloadsSubId, rg_web_workload)
params: {
Expand All @@ -68,7 +68,7 @@ module vnet 'br/public:network/virtual-network:1.1.3' = {
}

// Log Analytics workspace
module logAnalytics 'br/public:storage/log-analytics-workspace:1.0.3' = {
module logAnalytics 'br/public:avm/res/operational-insights/workspace:0.5.0' = {
name: '${uniqueString(deployment().name, location)}-ala'
scope: resourceGroup(rg_web_workload)
params: {
Expand All @@ -84,7 +84,7 @@ module appInsights 'modules/appInsights/appinsights.bicep' = {
params: {
name: appInsightsName
location: location
workspaceResourceId: logAnalytics.outputs.id
workspaceResourceId: logAnalytics.outputs.logAnalyticsWorkspaceId
kind: 'web'
applicationType: 'web'
}
Expand Down
6 changes: 5 additions & 1 deletion bicep-examples/scoped-deployments/management-scope.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ param location string = 'uksouth'
@description('Subscription Id.')
param subId string = 'subscription-guid-here'

@description('Storage Account name.')
param stName string = 'stname0001'

// Deploy Storage Account to existing resource group in a subscription from management scope
module st_deploy 'br/public:storage/storage-account:3.0.1' = {
module st_deploy 'br/public:avm/res/storage/storage-account:0.11.1' = {
scope: resourceGroup(subId, rg)
name: 'st_deploy'
params:{
name: stName
kind: 'StorageV2'
location: location
}
Expand Down
4 changes: 2 additions & 2 deletions bicep-examples/scoped-deployments/subscription-scope.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ location: location

// Deploy storage account to newly created resource group

module st_deploy 'br/public:storage/storage-account:3.0.1' = {
module st_deploy 'br/public:avm/res/storage/storage-account:0.11.1' = {
scope: rg_deploy
name: 'storageDeployment'
params:{
Expand All @@ -25,7 +25,7 @@ module st_deploy 'br/public:storage/storage-account:3.0.1' = {

// Deploy storage account to existing resource group in a subscription, without changing target scope

module st_deploy2 'br/public:storage/storage-account:3.0.1' = {
module st_deploy2 'br/public:avm/res/storage/storage-account:0.11.1' = {
scope: resourceGroup('subscription-guid-here', 'rg-name-here')
name: 'storageDeployment'
params:{
Expand Down
6 changes: 5 additions & 1 deletion bicep-examples/test-framework/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ param location string
@description('Storage account resource SKU.')
param kind string

@description('Storage account name.')
param stName string

// Storage Account
module storage 'br/public:storage/storage-account:3.0.1' = {
module storage 'br/public:avm/res/storage/storage-account:0.11.1' = {
name: 'storage_deploy'
params:{
name: stName
kind: kind
location: location
}
Expand Down
4 changes: 1 addition & 3 deletions bicep-examples/test-framework/main.bicepparam
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using './main.bicep'

@description('Deployment location for resources.')
param location = 'uksouth'

@description('Storage account resource SKU.')
param kind = 'storageV2'
param stName = 'stbicepifydemo001'
2 changes: 2 additions & 0 deletions bicep-examples/test-framework/tests.bicep
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Rios Engineer - Bicep Test Framework
test mainTest 'main.bicep' = {
params: {
stName: 'stbicepifydemo001'
kind: 'storageV2'
location: 'uksouth'
}
}

test mainTestFail 'main.bicep' = {
params: {
stName: 'stbicepifydemo001'
kind: 'BlobStorage'
location: 'northeurope'
}
Expand Down

0 comments on commit 16dbe53

Please sign in to comment.