Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
referencing keyvault properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Physer committed Dec 13, 2024
1 parent 9e9247d commit a8e3ccc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions infrastructure/cms.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ targetScope = 'subscription'
param environment string
param databaseClient string

var keyVaultName = 'kv-cms'

resource resourceGroup 'Microsoft.Resources/resourceGroups@2024-07-01' = {
name: 'rg-strapi-playground-${environment}'
location: deployment().location
Expand All @@ -22,7 +24,7 @@ module keyVault 'modules/keyVault.bicep' = {
scope: resourceGroup
name: 'deployCmsKeyVault'
params: {
keyVaultName: 'kv-cms'
keyVaultName: keyVaultName
cmsIdentityPrincipalId: cmsIdentity.outputs.cmsIdentityPrincipalId
}
}
Expand Down Expand Up @@ -66,16 +68,16 @@ module cmsContainerApp 'modules/containerApp.bicep' = {
}
}

resource keyVaultReference 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
resource existingKeyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
scope: resourceGroup
name: keyVault.outputs.resourceName
name: appendHash(keyVaultName)
}

module mysql 'modules/sql.bicep' = {
scope: resourceGroup
name: 'deployMysql'
params: {
sqlServerSaPassword: keyVaultReference.getSecret('mysql-sa-password')
sqlServerSaPassword: existingKeyVault.getSecret('mysql-sa-password')
}
}

Expand Down

0 comments on commit a8e3ccc

Please sign in to comment.