Skip to content

Commit 3aa1497

Browse files
committed
Revert "testing destroy recreate"
This reverts commit 146b354.
1 parent 9ca032f commit 3aa1497

File tree

3 files changed

+161
-161
lines changed

3 files changed

+161
-161
lines changed

5azd/infra/app/apim-api.bicep

Lines changed: 120 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,120 @@
1-
// param name string
2-
3-
// @description('Resource name to uniquely identify this API within the API Management service instance')
4-
// @minLength(1)
5-
// param apiName string
6-
7-
// @description('The Display Name of the API')
8-
// @minLength(1)
9-
// @maxLength(300)
10-
// param apiDisplayName string
11-
12-
// @description('Description of the API. May include HTML formatting tags.')
13-
// @minLength(1)
14-
// param apiDescription string
15-
16-
// @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.')
17-
// @minLength(1)
18-
// param apiPath string
19-
20-
// @description('Absolute URL of the web frontend')
21-
// param webFrontendUrl string
22-
23-
// @description('Absolute URL of the backend service implementing this API.')
24-
// param apiBackendUrl string
25-
26-
// @description('Resource name for backend Web App or Function App')
27-
// param apiAppName string = ''
28-
29-
// var apiPolicyContent = replace(loadTextContent('./apim-api-policy.xml'), '{origin}', webFrontendUrl)
30-
31-
// resource restApi 'Microsoft.ApiManagement/service/apis@2021-12-01-preview' = {
32-
// name: apiName
33-
// parent: apimService
34-
// properties: {
35-
// description: apiDescription
36-
// displayName: apiDisplayName
37-
// path: apiPath
38-
// protocols: [ 'https' ]
39-
// subscriptionRequired: false
40-
// type: 'http'
41-
// format: 'openapi'
42-
// serviceUrl: apiBackendUrl
43-
// value: loadTextContent('../../src/api/openapi.yaml')
44-
// }
45-
// }
46-
47-
// resource apiPolicy 'Microsoft.ApiManagement/service/apis/policies@2021-12-01-preview' = {
48-
// name: 'policy'
49-
// parent: restApi
50-
// properties: {
51-
// format: 'rawxml'
52-
// value: apiPolicyContent
53-
// }
54-
// }
55-
56-
// resource apiDiagnostics 'Microsoft.ApiManagement/service/apis/diagnostics@2021-12-01-preview' = {
57-
// name: 'applicationinsights'
58-
// parent: restApi
59-
// properties: {
60-
// alwaysLog: 'allErrors'
61-
// backend: {
62-
// request: {
63-
// body: {
64-
// bytes: 1024
65-
// }
66-
// }
67-
// response: {
68-
// body: {
69-
// bytes: 1024
70-
// }
71-
// }
72-
// }
73-
// frontend: {
74-
// request: {
75-
// body: {
76-
// bytes: 1024
77-
// }
78-
// }
79-
// response: {
80-
// body: {
81-
// bytes: 1024
82-
// }
83-
// }
84-
// }
85-
// httpCorrelationProtocol: 'W3C'
86-
// logClientIp: true
87-
// loggerId: apimLogger.id
88-
// metrics: true
89-
// sampling: {
90-
// percentage: 100
91-
// samplingType: 'fixed'
92-
// }
93-
// verbosity: 'verbose'
94-
// }
95-
// }
96-
97-
// resource apimService 'Microsoft.ApiManagement/service@2021-08-01' existing = {
98-
// name: name
99-
// }
100-
101-
// // Necessary due to https://github.com/Azure/bicep/issues/9594
102-
// // placeholderName is never deployed, it is merely used to make the child name validation pass
103-
// var appNameForBicep = !empty(apiAppName) ? apiAppName : 'placeholderName'
104-
105-
// resource apiAppProperties 'Microsoft.Web/sites/config@2022-03-01' = if (!empty(apiAppName)) {
106-
// name: '${appNameForBicep}/web'
107-
// kind: 'string'
108-
// properties: {
109-
// apiManagementConfig: {
110-
// id: '${apimService.id}/apis/${apiName}'
111-
// }
112-
// }
113-
// }
114-
115-
// resource apimLogger 'Microsoft.ApiManagement/service/loggers@2021-12-01-preview' existing = {
116-
// name: 'app-insights-logger'
117-
// parent: apimService
118-
// }
119-
120-
// output SERVICE_API_URI string = '${apimService.properties.gatewayUrl}/${apiPath}'
1+
param name string
2+
3+
@description('Resource name to uniquely identify this API within the API Management service instance')
4+
@minLength(1)
5+
param apiName string
6+
7+
@description('The Display Name of the API')
8+
@minLength(1)
9+
@maxLength(300)
10+
param apiDisplayName string
11+
12+
@description('Description of the API. May include HTML formatting tags.')
13+
@minLength(1)
14+
param apiDescription string
15+
16+
@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.')
17+
@minLength(1)
18+
param apiPath string
19+
20+
@description('Absolute URL of the web frontend')
21+
param webFrontendUrl string
22+
23+
@description('Absolute URL of the backend service implementing this API.')
24+
param apiBackendUrl string
25+
26+
@description('Resource name for backend Web App or Function App')
27+
param apiAppName string = ''
28+
29+
var apiPolicyContent = replace(loadTextContent('./apim-api-policy.xml'), '{origin}', webFrontendUrl)
30+
31+
resource restApi 'Microsoft.ApiManagement/service/apis@2021-12-01-preview' = {
32+
name: apiName
33+
parent: apimService
34+
properties: {
35+
description: apiDescription
36+
displayName: apiDisplayName
37+
path: apiPath
38+
protocols: [ 'https' ]
39+
subscriptionRequired: false
40+
type: 'http'
41+
format: 'openapi'
42+
serviceUrl: apiBackendUrl
43+
value: loadTextContent('../../src/api/openapi.yaml')
44+
}
45+
}
46+
47+
resource apiPolicy 'Microsoft.ApiManagement/service/apis/policies@2021-12-01-preview' = {
48+
name: 'policy'
49+
parent: restApi
50+
properties: {
51+
format: 'rawxml'
52+
value: apiPolicyContent
53+
}
54+
}
55+
56+
resource apiDiagnostics 'Microsoft.ApiManagement/service/apis/diagnostics@2021-12-01-preview' = {
57+
name: 'applicationinsights'
58+
parent: restApi
59+
properties: {
60+
alwaysLog: 'allErrors'
61+
backend: {
62+
request: {
63+
body: {
64+
bytes: 1024
65+
}
66+
}
67+
response: {
68+
body: {
69+
bytes: 1024
70+
}
71+
}
72+
}
73+
frontend: {
74+
request: {
75+
body: {
76+
bytes: 1024
77+
}
78+
}
79+
response: {
80+
body: {
81+
bytes: 1024
82+
}
83+
}
84+
}
85+
httpCorrelationProtocol: 'W3C'
86+
logClientIp: true
87+
loggerId: apimLogger.id
88+
metrics: true
89+
sampling: {
90+
percentage: 100
91+
samplingType: 'fixed'
92+
}
93+
verbosity: 'verbose'
94+
}
95+
}
96+
97+
resource apimService 'Microsoft.ApiManagement/service@2021-08-01' existing = {
98+
name: name
99+
}
100+
101+
// Necessary due to https://github.com/Azure/bicep/issues/9594
102+
// placeholderName is never deployed, it is merely used to make the child name validation pass
103+
var appNameForBicep = !empty(apiAppName) ? apiAppName : 'placeholderName'
104+
105+
resource apiAppProperties 'Microsoft.Web/sites/config@2022-03-01' = if (!empty(apiAppName)) {
106+
name: '${appNameForBicep}/web'
107+
kind: 'string'
108+
properties: {
109+
apiManagementConfig: {
110+
id: '${apimService.id}/apis/${apiName}'
111+
}
112+
}
113+
}
114+
115+
resource apimLogger 'Microsoft.ApiManagement/service/loggers@2021-12-01-preview' existing = {
116+
name: 'app-insights-logger'
117+
parent: apimService
118+
}
119+
120+
output SERVICE_API_URI string = '${apimService.properties.gatewayUrl}/${apiPath}'

5azd/infra/app/db.bicep

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
// param accountName string
2-
// param location string = resourceGroup().location
3-
// param tags object = {}
1+
param accountName string
2+
param location string = resourceGroup().location
3+
param tags object = {}
44

5-
// param collections array = [
6-
// {
7-
// name: 'TodoList'
8-
// id: 'TodoList'
9-
// shardKey: 'Hash'
10-
// indexKey: '_id'
11-
// }
12-
// {
13-
// name: 'TodoItem'
14-
// id: 'TodoItem'
15-
// shardKey: 'Hash'
16-
// indexKey: '_id'
17-
// }
18-
// ]
19-
// param databaseName string = ''
20-
// param keyVaultName string
5+
param collections array = [
6+
{
7+
name: 'TodoList'
8+
id: 'TodoList'
9+
shardKey: 'Hash'
10+
indexKey: '_id'
11+
}
12+
{
13+
name: 'TodoItem'
14+
id: 'TodoItem'
15+
shardKey: 'Hash'
16+
indexKey: '_id'
17+
}
18+
]
19+
param databaseName string = ''
20+
param keyVaultName string
2121

22-
// // Because databaseName is optional in main.bicep, we make sure the database name is set here.
23-
// var defaultDatabaseName = 'Todo'
24-
// var actualDatabaseName = !empty(databaseName) ? databaseName : defaultDatabaseName
22+
// Because databaseName is optional in main.bicep, we make sure the database name is set here.
23+
var defaultDatabaseName = 'Todo'
24+
var actualDatabaseName = !empty(databaseName) ? databaseName : defaultDatabaseName
2525

26-
// module cosmos '../core/database/cosmos/mongo/cosmos-mongo-db.bicep' = {
27-
// name: 'cosmos-mongo'
28-
// params: {
29-
// accountName: accountName
30-
// databaseName: actualDatabaseName
31-
// location: location
32-
// collections: collections
33-
// keyVaultName: keyVaultName
34-
// tags: tags
35-
// }
36-
// }
26+
module cosmos '../core/database/cosmos/mongo/cosmos-mongo-db.bicep' = {
27+
name: 'cosmos-mongo'
28+
params: {
29+
accountName: accountName
30+
databaseName: actualDatabaseName
31+
location: location
32+
collections: collections
33+
keyVaultName: keyVaultName
34+
tags: tags
35+
}
36+
}
3737

38-
// output connectionStringKey string = cosmos.outputs.connectionStringKey
39-
// output databaseName string = cosmos.outputs.databaseName
40-
// output endpoint string = cosmos.outputs.endpoint
38+
output connectionStringKey string = cosmos.outputs.connectionStringKey
39+
output databaseName string = cosmos.outputs.databaseName
40+
output endpoint string = cosmos.outputs.endpoint

5azd/infra/main.bicep

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ param webServiceName string = ''
2929
@description('Flag to use Azure API Management to mediate the calls between the Web frontend and the backend API')
3030
param useAPIM bool = false
3131

32-
// @description('API Management SKU to use if APIM is enabled')
33-
// param apimSku string = 'Consumption'
32+
@description('API Management SKU to use if APIM is enabled')
33+
param apimSku string = 'Consumption'
3434

3535
@description('Id of the user or app to assign application roles')
3636
param principalId string = ''
@@ -69,12 +69,12 @@ module api './app/api.bicep' = {
6969
appServicePlanId: appServicePlan.outputs.id
7070
keyVaultName: keyVault.outputs.name
7171
storageAccountName: storage.outputs.name
72-
//allowedOrigins: [ web.outputs.SERVICE_WEB_URI ]
72+
allowedOrigins: [ web.outputs.SERVICE_WEB_URI ]
7373
appSettings: {
7474
// AZURE_COSMOS_CONNECTION_STRING_KEY: cosmos.outputs.connectionStringKey
7575
// AZURE_COSMOS_DATABASE_NAME: cosmos.outputs.databaseName
7676
// AZURE_COSMOS_ENDPOINT: cosmos.outputs.endpoint
77-
// API_ALLOW_ORIGINS: web.outputs.SERVICE_WEB_URI
77+
API_ALLOW_ORIGINS: web.outputs.SERVICE_WEB_URI
7878
}
7979
}
8080
}
@@ -192,7 +192,7 @@ output AZURE_KEY_VAULT_ENDPOINT string = keyVault.outputs.endpoint
192192
output AZURE_KEY_VAULT_NAME string = keyVault.outputs.name
193193
output AZURE_LOCATION string = location
194194
output AZURE_TENANT_ID string = tenant().tenantId
195-
output REACT_APP_API_BASE_URL string = useAPIM ? apimApi.outputs.SERVICE_API_URI : api.outputs.SERVICE_API_URI
195+
// output REACT_APP_API_BASE_URL string = useAPIM ? apimApi.outputs.SERVICE_API_URI : api.outputs.SERVICE_API_URI
196196
output REACT_APP_APPLICATIONINSIGHTS_CONNECTION_STRING string = monitoring.outputs.applicationInsightsConnectionString
197197
output REACT_APP_WEB_BASE_URL string = web.outputs.SERVICE_WEB_URI
198198
output USE_APIM bool = useAPIM

0 commit comments

Comments
 (0)