-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor the database modules and move to AVM #86
Open
tonybaloney
wants to merge
19
commits into
main
Choose a base branch
from
avm_cosmos
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7354d23
Start to refactor the database module into separate files
tonybaloney 2ea6e97
Remove trailing endif
tonybaloney d45101e
Add missing variable assignment
tonybaloney 84f6be4
Add missing outputs.
tonybaloney 257818c
Refactor out all AZD related database code.
tonybaloney 91a11e6
hardcode a parameter to fix the linter
tonybaloney bf15bac
The audit workflow at this level makes no sense
tonybaloney 8f4b6e4
Use keys for cosmos mongo
tonybaloney 42f0057
Add subnet for databases
tonybaloney 01d78dc
Fix dependency cycles
tonybaloney a7f0cc7
Filter out the container app resource as it confuses AZD
tonybaloney cd33bfe
fix jinja rule
tonybaloney 9cb507a
Network controls in cosmos
tonybaloney 032fe3d
service endpoint for cosmos
tonybaloney 5db2527
Update rules
tonybaloney 99f197d
Fixup the network access rule and service endpoint
tonybaloney fa0df6b
Correct private DNS zones for cosmos and keyvault
tonybaloney 9a04f0f
Move the private DNS zone for cosmos into the cosmos file
tonybaloney 63b683e
Don't use SECRETKEY for Flask apps
tonybaloney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
{{cookiecutter.__src_folder_name}}/infra/db/cosmos-mongodb.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
param name string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
param prefix string | ||
param keyVaultName string | ||
param dbserverDatabaseName string | ||
|
||
module dbserver '../core/database/cosmos/mongo/cosmos-mongo-db.bicep' = { | ||
name: name | ||
params: { | ||
accountName: '${take(prefix, 36)}-mongodb' // Max 44 characters | ||
location: location | ||
databaseName: dbserverDatabaseName | ||
tags: tags | ||
keyVaultName: keyVaultName | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
{{cookiecutter.__src_folder_name}}/infra/db/cosmos-postgres.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// {% set pg_version = 15 %} | ||
|
||
param name string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
param prefix string | ||
param dbserverDatabaseName string | ||
var dbserverUser = 'citus' | ||
@secure() | ||
param dbserverPassword string | ||
|
||
module dbserver '../core/database/cosmos/cosmos-pg-adapter.bicep' = { | ||
name: name | ||
params: { | ||
name: '${prefix}-postgresql' | ||
location: location | ||
tags: tags | ||
postgresqlVersion: '{{pg_version}}' | ||
administratorLogin: dbserverUser | ||
administratorLoginPassword: dbserverPassword | ||
databaseName: dbserverDatabaseName | ||
allowAzureIPsFirewall: true | ||
coordinatorServerEdition: 'BurstableMemoryOptimized' | ||
coordinatorStorageQuotainMb: 131072 | ||
coordinatorVCores: 1 | ||
nodeCount: 0 | ||
nodeVCores: 4 | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
{{cookiecutter.__src_folder_name}}/infra/db/postgres-addon.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
param containerAppsEnvironmentName string | ||
param name string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
param prefix string | ||
|
||
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2022-03-01' existing = { | ||
name: containerAppsEnvironmentName | ||
} | ||
|
||
module dbserver '../core/database/postgresql/aca-service.bicep' = { | ||
name: name | ||
params: { | ||
name: '${take(prefix, 29)}-pg' // max 32 characters | ||
location: location | ||
tags: tags | ||
containerAppsEnvironmentId: containerAppsEnvironment.id | ||
} | ||
} | ||
|
||
output id string = dbserver.outputs.id |
37 changes: 37 additions & 0 deletions
37
{{cookiecutter.__src_folder_name}}/infra/db/postgres-flexible.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
param name string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
param prefix string | ||
|
||
// value is read-only in cosmos | ||
var dbserverUser = 'admin${uniqueString(resourceGroup().id)}' | ||
@secure() | ||
param dbserverPassword string = '' | ||
param dbserverDatabaseName string = '' | ||
|
||
module dbserver '../core/database/postgresql/flexibleserver.bicep' = { | ||
name: name | ||
params: { | ||
name: '${prefix}-postgresql' | ||
location: location | ||
tags: tags | ||
sku: { | ||
name: 'Standard_B1ms' | ||
tier: 'Burstable' | ||
} | ||
storage: { | ||
storageSizeGB: 32 | ||
} | ||
version: '{{pg_version}}' | ||
administratorLogin: dbserverUser | ||
administratorLoginPassword: dbserverPassword | ||
databaseNames: [dbserverDatabaseName] | ||
allowAzureIPsFirewall: true | ||
} | ||
} | ||
|
||
output dbserverDatabaseName string = dbserverDatabaseName | ||
output dbserverUser string = dbserverUser | ||
|
||
// "postgres-flexible", "cosmos-postgres" | ||
output dbserverDomainName string = dbserver.outputs.domainName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / templateanalyzer
Administrator Username Types. Error