Skip to content
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

Update the infra/core modules to AVM modules #3976

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
953f948
Convert infra/core to AVM
Menghua1 Jun 4, 2024
a66ba8a
Add the modification of repo.yaml
Menghua1 Jun 4, 2024
a6034f5
Modify parameter description, spaces, etc.
Menghua1 Jun 4, 2024
3163c23
Standard parameter naming
Menghua1 Jun 6, 2024
b3a89a8
modify models.py
Menghua1 Jun 19, 2024
50473a4
fix pr2016 and pr2103
Menghua1 Jun 21, 2024
4b2f44a
update apim service toavm module
Menghua1 Jun 24, 2024
00648d5
Add useAPIM conditional judgment
Menghua1 Jun 24, 2024
cef4144
update web site config to avm
Menghua1 Jul 5, 2024
ffa27d9
add api tags
Menghua1 Jul 5, 2024
93de7e6
update keyvault sku
Menghua1 Jul 9, 2024
9f95b92
disable purge protection
Menghua1 Jul 9, 2024
b3fd198
disable purge protection
Menghua1 Jul 9, 2024
a6a3010
Merge remote-tracking branch 'origin/main' into avmupdates
Menghua1 Jul 10, 2024
9b54ddd
Merge remote-tracking branch 'origin/main' into avmupdates
Menghua1 Aug 23, 2024
868ab2e
Add Infra/app files
Menghua1 Sep 2, 2024
7ad17e8
modify parameters
Menghua1 Sep 2, 2024
26963c9
Modify api-avm parameters
Menghua1 Sep 3, 2024
56d33e9
update apimapi to use ptn module
Menghua1 Sep 29, 2024
8f34f52
Merge branch 'main' into avmupdates
Menghua1 Sep 29, 2024
3399e7f
update db to infra/app
Menghua1 Sep 29, 2024
bab182b
Merge branch 'main' into avmupdates
Menghua1 Oct 9, 2024
17f0961
Update apim parameter, cosmos-sql
Menghua1 Oct 9, 2024
93947a2
Update cosmos-mongo module name
Menghua1 Oct 9, 2024
fd8a899
delete the redundant parameter connectionStringKey
Menghua1 Oct 11, 2024
52ddfbe
add monitor ptn module
Menghua1 Oct 12, 2024
def0102
Merge branch 'main' into avmupdates
Menghua1 Oct 15, 2024
1f7da17
add container pth module
Menghua1 Oct 15, 2024
f1077a7
update cosmos-mongo-db-avm output
Menghua1 Oct 22, 2024
828f2a6
update aks and aca to avm
Menghua1 Oct 28, 2024
8910cac
Update appservice with App Insights env var
Menghua1 Oct 28, 2024
260ac1c
Merge branch 'main' into avmupdates
Menghua1 Oct 28, 2024
7eff057
Update module name
Menghua1 Oct 28, 2024
5406a10
Update module container-app-upsert version
Menghua1 Oct 29, 2024
b8ff872
Merge branch 'main' into avmupdates
Menghua1 Nov 20, 2024
257f48a
update nodeResourceGroupName parameter
Menghua1 Nov 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions templates/todo/api/python/todo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ def __init__(self, *args, **kwargs):
credential = DefaultAzureCredential()
keyvault_client = SecretClient(self.AZURE_KEY_VAULT_ENDPOINT, credential)
for secret in keyvault_client.list_properties_of_secrets():
setattr(
self,
keyvault_name_as_attr(secret.name),
keyvault_client.get_secret(secret.name).value,
)
if secret.name == "AZURE-COSMOS-CONNECTION-STRING":
jongio marked this conversation as resolved.
Show resolved Hide resolved
setattr(
self,
keyvault_name_as_attr(secret.name),
keyvault_client.get_secret(secret.name).value,
)

AZURE_COSMOS_CONNECTION_STRING: str = ""
AZURE_COSMOS_DATABASE_NAME: str = "Todo"
Expand Down
99 changes: 99 additions & 0 deletions templates/todo/common/infra/bicep/app/apim-api-settings.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
@description('Resource name for the existing apim service')
param name string

@description('Resource name to uniquely identify this API within the API Management service instance')
@minLength(1)
param apiName string

@description('Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.')
@minLength(1)
param apiPath string

@description('Resource name for the existing applicationInsights service')
param applicationInsightsName string

@description('Resource name for backend Web App or Function App')
param apiAppName string = ''

// Necessary due to https://github.com/Azure/bicep/issues/9594
Menghua1 marked this conversation as resolved.
Show resolved Hide resolved
// placeholderName is never deployed, it is merely used to make the child name validation pass
var appNameForBicep = !empty(apiAppName) ? apiAppName : 'placeholderName'

resource apiDiagnostics 'Microsoft.ApiManagement/service/apis/diagnostics@2021-12-01-preview' = {
name: 'applicationinsights'
parent: apimService::restApi
properties: {
alwaysLog: 'allErrors'
backend: {
request: {
body: {
bytes: 1024
}
}
response: {
body: {
bytes: 1024
}
}
}
frontend: {
request: {
body: {
bytes: 1024
}
}
response: {
body: {
bytes: 1024
}
}
}
httpCorrelationProtocol: 'W3C'
logClientIp: true
loggerId: apimLogger.id
metrics: true
sampling: {
percentage: 100
samplingType: 'fixed'
}
verbosity: 'verbose'
}
}

resource apiAppProperties 'Microsoft.Web/sites/config@2022-03-01' = if (!empty(apiAppName)) {
name: '${appNameForBicep}/web'
kind: 'string'
properties: {
apiManagementConfig: {
id: '${apimService.id}/apis/${apiName}'
}
}
}

resource apimLogger 'Microsoft.ApiManagement/service/loggers@2021-12-01-preview' = if (!empty(applicationInsightsName)) {
name: 'app-insights-logger'
parent: apimService
properties: {
credentials: {
instrumentationKey: applicationInsights.properties.InstrumentationKey
}
description: 'Logger to Azure Application Insights'
isBuffered: false
loggerType: 'applicationInsights'
resourceId: applicationInsights.id
}
}

resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing = if (!empty(applicationInsightsName)) {
name: applicationInsightsName
}

resource apimService 'Microsoft.ApiManagement/service@2021-08-01' existing = {
name: name

resource restApi 'apis@2021-12-01-preview' existing = {
name: apiName
}
}

output SERVICE_API_URI string = '${apimService.properties.gatewayUrl}/${apiPath}'
Loading
Loading