-
Notifications
You must be signed in to change notification settings - Fork 207
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 of "todo-python-mongo" #3872
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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 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
97 changes: 97 additions & 0 deletions
97
templates/todo/common/infra/bicep/app/apim-api-settings.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,97 @@ | ||
@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 | ||
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 | ||
// 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}' |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why update to only set this secret?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because when using
infra/core/database
to createCosmos Mongo
, only one secret named "AZURE-COSMOS-CONNECTION-STRING" will be created in keyVault, the specific code is here.But now when using
AVM
to createCosmos Mongo
, multiple secrets are created and the specific code is here. The backend will fail to obtain "AZURE-COSMOS-CONNECTION-STRING" in the secret. It will succeed only whensecret.name == "AZURE-COSMOS-CONNECTION-STRING"
is specified.