forked from microsoft/PubSec-Info-Assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
501 lines (456 loc) · 25.2 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
locals {
tags = { ProjectName = "Information Assistant", BuildNumber = var.buildNumber }
azure_roles = jsondecode(file("${path.module}/azure_roles.json"))
selected_roles = ["CognitiveServicesOpenAIUser", "StorageBlobDataReader", "StorageBlobDataContributor", "SearchIndexDataReader", "SearchIndexDataContributor"]
}
data "azurerm_client_config" "current" {}
resource "random_string" "random" {
length = 5
special = false
upper = false
number = false
}
// Organize resources in a resource group
resource "azurerm_resource_group" "rg" {
name = var.resourceGroupName != "" ? var.resourceGroupName : "infoasst-${var.environmentName}"
location = var.location
tags = local.tags
}
module "entraObjects" {
source = "./core/aad"
isInAutomation = var.isInAutomation
requireWebsiteSecurityMembership = var.requireWebsiteSecurityMembership
randomString = random_string.random.result
azure_websites_domain = var.azure_websites_domain
aadWebClientId = var.aadWebClientId
aadMgmtClientId = var.aadMgmtClientId
aadMgmtServicePrincipalId = var.aadMgmtServicePrincipalId
aadMgmtClientSecret = var.aadMgmtClientSecret
}
module "logging" {
source = "./core/logging/loganalytics"
logAnalyticsName = var.logAnalyticsName != "" ? var.logAnalyticsName : "infoasst-la-${random_string.random.result}"
applicationInsightsName = var.applicationInsightsName != "" ? var.applicationInsightsName : "infoasst-ai-${random_string.random.result}"
location = var.location
tags = local.tags
skuName = "PerGB2018"
resourceGroupName = azurerm_resource_group.rg.name
}
module "storage" {
source = "./core/storage"
name = var.storageAccountName != "" ? var.storageAccountName : "infoasststore${random_string.random.result}"
location = var.location
tags = local.tags
accessTier = "Hot"
allowBlobPublicAccess = false
publicNetworkAccess = true
resourceGroupName = azurerm_resource_group.rg.name
keyVaultId = module.kvModule.keyVaultId
deleteRetentionPolicy = {
days = 7
}
containers = ["content","website","upload","function","logs","config"]
queueNames = ["pdf-submit-queue","pdf-polling-queue","non-pdf-submit-queue","media-submit-queue","text-enrichment-queue","image-enrichment-queue","embeddings-queue"]
}
module "enrichmentApp" {
source = "./core/host/enrichmentapp"
name = var.enrichmentServiceName != "" ? var.enrichmentServiceName : "infoasst-enrichmentweb-${random_string.random.result}"
plan_name = var.enrichmentAppServicePlanName != "" ? var.enrichmentAppServicePlanName : "infoasst-enrichmentasp-${random_string.random.result}"
location = var.location
tags = local.tags
sku = {
size = var.enrichmentAppServiceSkuSize
tier = var.enrichmentAppServiceSkuTier
capacity = 3
}
kind = "linux"
reserved = true
resourceGroupName = azurerm_resource_group.rg.name
storageAccountId = "/subscriptions/${var.subscriptionId}/resourceGroups/${azurerm_resource_group.rg.name}/providers/Microsoft.Storage/storageAccounts/${module.storage.name}/services/queue/queues/${var.embeddingsQueue}"
scmDoBuildDuringDeployment = true
managedIdentity = true
logAnalyticsWorkspaceResourceId = module.logging.logAnalyticsId
applicationInsightsConnectionString = module.logging.applicationInsightsConnectionString
alwaysOn = true
healthCheckPath = "/health"
appCommandLine = "gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app"
keyVaultUri = module.kvModule.keyVaultUri
keyVaultName = module.kvModule.keyVaultName
appSettings = {
EMBEDDINGS_QUEUE = var.embeddingsQueue
LOG_LEVEL = "DEBUG"
DEQUEUE_MESSAGE_BATCH_SIZE = 1
AZURE_BLOB_STORAGE_ACCOUNT = module.storage.name
AZURE_BLOB_STORAGE_CONTAINER = var.contentContainerName
AZURE_BLOB_STORAGE_UPLOAD_CONTAINER = var.uploadContainerName
AZURE_BLOB_STORAGE_ENDPOINT = module.storage.primary_endpoints
COSMOSDB_URL = module.cosmosdb.CosmosDBEndpointURL
COSMOSDB_LOG_DATABASE_NAME = module.cosmosdb.CosmosDBLogDatabaseName
COSMOSDB_LOG_CONTAINER_NAME = module.cosmosdb.CosmosDBLogContainerName
MAX_EMBEDDING_REQUEUE_COUNT = 5
EMBEDDING_REQUEUE_BACKOFF = 60
AZURE_OPENAI_SERVICE = var.useExistingAOAIService ? var.azureOpenAIServiceName : module.openaiServices.name
AZURE_OPENAI_ENDPOINT = var.useExistingAOAIService ? "https://${var.azureOpenAIServiceName}.${var.azure_openai_domain}/" : module.openaiServices.endpoint
AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME = var.azureOpenAIEmbeddingDeploymentName
AZURE_SEARCH_INDEX = var.searchIndexName
AZURE_SEARCH_SERVICE = module.searchServices.name
TARGET_EMBEDDINGS_MODEL = var.useAzureOpenAIEmbeddings ? "azure-openai_${var.azureOpenAIEmbeddingDeploymentName}" : var.sentenceTransformersModelName
EMBEDDING_VECTOR_SIZE = var.useAzureOpenAIEmbeddings ? 1536 : var.sentenceTransformerEmbeddingVectorSize
AZURE_SEARCH_SERVICE_ENDPOINT = module.searchServices.endpoint
WEBSITES_CONTAINER_START_TIME_LIMIT = 600
}
depends_on = [ module.kvModule ]
}
# // The application frontend
module "backend" {
source = "./core/host/webapp"
name = var.backendServiceName != "" ? var.backendServiceName : "infoasst-web-${random_string.random.result}"
plan_name = var.appServicePlanName != "" ? var.appServicePlanName : "infoasst-asp-${random_string.random.result}"
sku = {
tier = var.appServiceSkuTier
size = var.appServiceSkuSize
capacity = 1
}
kind = "linux"
resourceGroupName = azurerm_resource_group.rg.name
location = var.location
tags = merge(local.tags, { "azd-service-name" = "backend" })
runtimeVersion = "3.10"
scmDoBuildDuringDeployment = true
managedIdentity = true
appCommandLine = "gunicorn --workers 2 --worker-class uvicorn.workers.UvicornWorker app:app --timeout 600"
logAnalyticsWorkspaceResourceId = module.logging.logAnalyticsId
azure_portal_domain = var.azure_portal_domain
enableOryxBuild = true
applicationInsightsConnectionString = module.logging.applicationInsightsConnectionString
keyVaultUri = module.kvModule.keyVaultUri
keyVaultName = module.kvModule.keyVaultName
tenantId = var.tenantId
appSettings = {
APPLICATIONINSIGHTS_CONNECTION_STRING = module.logging.applicationInsightsConnectionString
AZURE_BLOB_STORAGE_ACCOUNT = module.storage.name
AZURE_BLOB_STORAGE_ENDPOINT = module.storage.primary_endpoints
AZURE_BLOB_STORAGE_CONTAINER = var.contentContainerName
AZURE_BLOB_STORAGE_UPLOAD_CONTAINER = var.uploadContainerName
AZURE_OPENAI_SERVICE = var.useExistingAOAIService ? var.azureOpenAIServiceName : module.openaiServices.name
AZURE_OPENAI_RESOURCE_GROUP = var.useExistingAOAIService ? var.azureOpenAIResourceGroup : azurerm_resource_group.rg.name
AZURE_OPENAI_ENDPOINT = var.useExistingAOAIService ? "https://${var.azureOpenAIServiceName}.${var.azure_openai_domain}/" : module.openaiServices.endpoint
AZURE_OPENAI_AUTHORITY_HOST = var.azure_openai_authority_host
AZURE_ARM_MANAGEMENT_API = var.azure_arm_management_api
AZURE_SEARCH_INDEX = var.searchIndexName
AZURE_SEARCH_SERVICE = module.searchServices.name
AZURE_SEARCH_SERVICE_ENDPOINT = module.searchServices.endpoint
AZURE_OPENAI_CHATGPT_DEPLOYMENT = var.chatGptDeploymentName != "" ? var.chatGptDeploymentName : (var.chatGptModelName != "" ? var.chatGptModelName : "gpt-35-turbo-16k")
AZURE_OPENAI_CHATGPT_MODEL_NAME = var.chatGptModelName
AZURE_OPENAI_CHATGPT_MODEL_VERSION = var.chatGptModelVersion
USE_AZURE_OPENAI_EMBEDDINGS = var.useAzureOpenAIEmbeddings
EMBEDDING_DEPLOYMENT_NAME = var.useAzureOpenAIEmbeddings ? var.azureOpenAIEmbeddingDeploymentName : var.sentenceTransformersModelName
AZURE_OPENAI_EMBEDDINGS_MODEL_NAME = var.azureOpenAIEmbeddingsModelName
AZURE_OPENAI_EMBEDDINGS_MODEL_VERSION = var.azureOpenAIEmbeddingsModelVersion
APPINSIGHTS_INSTRUMENTATIONKEY = module.logging.applicationInsightsInstrumentationKey
COSMOSDB_URL = module.cosmosdb.CosmosDBEndpointURL
COSMOSDB_LOG_DATABASE_NAME = module.cosmosdb.CosmosDBLogDatabaseName
COSMOSDB_LOG_CONTAINER_NAME = module.cosmosdb.CosmosDBLogContainerName
QUERY_TERM_LANGUAGE = var.queryTermLanguage
AZURE_SUBSCRIPTION_ID = data.azurerm_client_config.current.subscription_id
CHAT_WARNING_BANNER_TEXT = var.chatWarningBannerText
TARGET_EMBEDDINGS_MODEL = var.useAzureOpenAIEmbeddings ? "azure-openai_${var.azureOpenAIEmbeddingDeploymentName}" : var.sentenceTransformersModelName
ENRICHMENT_APPSERVICE_URL = module.enrichmentApp.uri
ENRICHMENT_ENDPOINT = module.cognitiveServices.cognitiveServiceEndpoint
APPLICATION_TITLE = var.applicationtitle == "" ? "Information Assistant, built with Azure OpenAI" : var.applicationtitle
AZURE_AI_TRANSLATION_DOMAIN = var.azure_ai_translation_domain
USE_SEMANTIC_RERANKER = var.use_semantic_reranker
BING_SEARCH_ENDPOINT = var.enableWebChat ? module.bingSearch.endpoint : ""
ENABLE_WEB_CHAT = var.enableWebChat
ENABLE_BING_SAFE_SEARCH = var.enableBingSafeSearch
ENABLE_UNGROUNDED_CHAT = var.enableUngroundedChat
ENABLE_MATH_ASSISTANT = var.enableMathAssitant
ENABLE_TABULAR_DATA_ASSISTANT = var.enableTabularDataAssistant
ENABLE_MULTIMEDIA = var.enableMultimedia
MAX_CSV_FILE_SIZE = var.maxCsvFileSize
}
aadClientId = module.entraObjects.azure_ad_web_app_client_id
depends_on = [ module.kvModule ]
}
module "openaiServices" {
source = "./core/ai/openaiservices"
name = var.openAIServiceName != "" ? var.openAIServiceName : "infoasst-aoai-${random_string.random.result}"
location = var.location
tags = local.tags
resourceGroupName = azurerm_resource_group.rg.name
keyVaultId = module.kvModule.keyVaultId
openaiServiceKey = var.azureOpenAIServiceKey
useExistingAOAIService = var.useExistingAOAIService
deployments = [
{
name = var.chatGptDeploymentName != "" ? var.chatGptDeploymentName : (var.chatGptModelName != "" ? var.chatGptModelName : "gpt-35-turbo-16k")
model = {
format = "OpenAI"
name = var.chatGptModelName != "" ? var.chatGptModelName : "gpt-35-turbo-16k"
version = var.chatGptModelVersion != "" ? var.chatGptModelVersion : "0613"
}
sku_name = "Standard"
sku_capacity = var.chatGptDeploymentCapacity
rai_policy_name = "Microsoft.Default"
},
{
name = var.azureOpenAIEmbeddingDeploymentName != "" ? var.azureOpenAIEmbeddingDeploymentName : "text-embedding-ada-002"
model = {
format = "OpenAI"
name = var.azureOpenAIEmbeddingsModelName != "" ? var.azureOpenAIEmbeddingsModelName : "text-embedding-ada-002"
version = "2"
}
sku_name = "Standard"
sku_capacity = var.embeddingsDeploymentCapacity
rai_policy_name = "Microsoft.Default"
}
]
}
module "formrecognizer" {
source = "./core/ai/docintelligence"
name = "infoasst-fr-${random_string.random.result}"
location = var.location
tags = local.tags
customSubDomainName = "infoasst-fr-${random_string.random.result}"
resourceGroupName = azurerm_resource_group.rg.name
keyVaultId = module.kvModule.keyVaultId
}
module "cognitiveServices" {
source = "./core/ai/cogServices"
name = "infoasst-enrichment-cog-${random_string.random.result}"
location = var.location
tags = local.tags
keyVaultId = module.kvModule.keyVaultId
resourceGroupName = azurerm_resource_group.rg.name
}
module "searchServices" {
source = "./core/search"
name = var.searchServicesName != "" ? var.searchServicesName : "infoasst-search-${random_string.random.result}"
location = var.location
tags = local.tags
# aad_auth_failure_mode = "http401WithBearerChallenge"
# sku_name = var.searchServicesSkuName
semanticSearch = var.use_semantic_reranker ? "free" : null
resourceGroupName = azurerm_resource_group.rg.name
keyVaultId = module.kvModule.keyVaultId
azure_search_domain = var.azure_search_domain
}
module "cosmosdb" {
source = "./core/db"
name = "infoasst-cosmos-${random_string.random.result}"
location = var.location
tags = local.tags
logDatabaseName = "statusdb"
logContainerName = "statuscontainer"
resourceGroupName = azurerm_resource_group.rg.name
keyVaultId = module.kvModule.keyVaultId
}
# // Function App
module "functions" {
source = "./core/host/functions"
name = var.functionsAppName != "" ? var.functionsAppName : "infoasst-func-${random_string.random.result}"
location = var.location
tags = local.tags
keyVaultUri = module.kvModule.keyVaultUri
keyVaultName = module.kvModule.keyVaultName
plan_name = var.appServicePlanName != "" ? var.appServicePlanName : "infoasst-func-asp-${random_string.random.result}"
sku = {
size = var.functionsAppSkuSize
tier = var.functionsAppSkuTier
capacity = 2
}
kind = "linux"
runtime = "python"
resourceGroupName = azurerm_resource_group.rg.name
appInsightsConnectionString = module.logging.applicationInsightsConnectionString
appInsightsInstrumentationKey = module.logging.applicationInsightsInstrumentationKey
blobStorageAccountName = module.storage.name
blobStorageAccountEndpoint = module.storage.primary_endpoints
blobStorageAccountOutputContainerName = var.contentContainerName
blobStorageAccountUploadContainerName = var.uploadContainerName
blobStorageAccountLogContainerName = var.functionLogsContainerName
formRecognizerEndpoint = module.formrecognizer.formRecognizerAccountEndpoint
CosmosDBEndpointURL = module.cosmosdb.CosmosDBEndpointURL
CosmosDBLogDatabaseName = module.cosmosdb.CosmosDBLogDatabaseName
CosmosDBLogContainerName = module.cosmosdb.CosmosDBLogContainerName
chunkTargetSize = var.chunkTargetSize
targetPages = var.targetPages
formRecognizerApiVersion = var.formRecognizerApiVersion
pdfSubmitQueue = var.pdfSubmitQueue
pdfPollingQueue = var.pdfPollingQueue
nonPdfSubmitQueue = var.nonPdfSubmitQueue
mediaSubmitQueue = var.mediaSubmitQueue
maxSecondsHideOnUpload = var.maxSecondsHideOnUpload
maxSubmitRequeueCount = var.maxSubmitRequeueCount
pollQueueSubmitBackoff = var.pollQueueSubmitBackoff
pdfSubmitQueueBackoff = var.pdfSubmitQueueBackoff
textEnrichmentQueue = var.textEnrichmentQueue
imageEnrichmentQueue = var.imageEnrichmentQueue
maxPollingRequeueCount = var.maxPollingRequeueCount
submitRequeueHideSeconds = var.submitRequeueHideSeconds
pollingBackoff = var.pollingBackoff
maxReadAttempts = var.maxReadAttempts
enrichmentEndpoint = module.cognitiveServices.cognitiveServiceEndpoint
enrichmentName = module.cognitiveServices.cognitiveServicerAccountName
enrichmentLocation = var.location
targetTranslationLanguage = var.targetTranslationLanguage
maxEnrichmentRequeueCount = var.maxEnrichmentRequeueCount
enrichmentBackoff = var.enrichmentBackoff
enableDevCode = var.enableDevCode
EMBEDDINGS_QUEUE = var.embeddingsQueue
azureSearchIndex = var.searchIndexName
azureSearchServiceEndpoint = module.searchServices.endpoint
endpointSuffix = var.azure_storage_domain
azure_ai_text_analytics_domain = var.azure_ai_text_analytics_domain
azure_ai_translation_domain = var.azure_ai_translation_domain
depends_on = [
module.storage,
module.cosmosdb,
module.kvModule
]
}
module "sharepoint" {
count = var.enableSharePointConnector ? 1 : 0
source = "./core/sharepoint"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
resource_group_id = azurerm_resource_group.rg.id
subscription_id = data.azurerm_client_config.current.subscription_id
storage_account_name = module.storage.name
storage_access_key = module.storage.storage_account_access_key
random_string = random_string.random.result
tags = local.tags
depends_on = [
module.storage
]
}
module "video_indexer" {
count = var.enableMultimedia ? 1 : 0
source = "./core/videoindexer"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
subscription_id = data.azurerm_client_config.current.subscription_id
random_string = random_string.random.result
tags = local.tags
azuread_service_principal_object_id = module.entraObjects.azure_ad_web_app_client_id
arm_template_schema_mgmt_api = var.arm_template_schema_mgmt_api
video_indexer_api_version = var.video_indexer_api_version
}
// USER ROLES
module "userRoles" {
source = "./core/security/role"
for_each = { for role in local.selected_roles : role => { role_definition_id = local.azure_roles[role] } }
scope = azurerm_resource_group.rg.id
principalId = data.azurerm_client_config.current.object_id
roleDefinitionId = each.value.role_definition_id
principalType = var.isInAutomation ? "ServicePrincipal" : "User"
subscriptionId = data.azurerm_client_config.current.subscription_id
resourceGroupId = azurerm_resource_group.rg.id
}
data "azurerm_resource_group" "existing" {
count = var.useExistingAOAIService ? 1 : 0
name = var.azureOpenAIResourceGroup
}
# # // SYSTEM IDENTITY ROLES
module "openAiRoleBackend" {
source = "./core/security/role"
scope = var.useExistingAOAIService ? data.azurerm_resource_group.existing[0].id : azurerm_resource_group.rg.id
principalId = module.backend.identityPrincipalId
roleDefinitionId = local.azure_roles.CognitiveServicesOpenAIUser
principalType = "ServicePrincipal"
subscriptionId = data.azurerm_client_config.current.subscription_id
resourceGroupId = azurerm_resource_group.rg.id
}
module "storageRoleBackend" {
source = "./core/security/role"
scope = azurerm_resource_group.rg.id
principalId = module.backend.identityPrincipalId
roleDefinitionId = local.azure_roles.StorageBlobDataReader
principalType = "ServicePrincipal"
subscriptionId = data.azurerm_client_config.current.subscription_id
resourceGroupId = azurerm_resource_group.rg.id
}
module "searchRoleBackend" {
source = "./core/security/role"
scope = azurerm_resource_group.rg.id
principalId = module.backend.identityPrincipalId
roleDefinitionId = local.azure_roles.SearchIndexDataReader
principalType = "ServicePrincipal"
subscriptionId = data.azurerm_client_config.current.subscription_id
resourceGroupId = azurerm_resource_group.rg.id
}
module "storageRoleFunc" {
source = "./core/security/role"
scope = azurerm_resource_group.rg.id
principalId = module.functions.function_app_identity_principal_id
roleDefinitionId = local.azure_roles.StorageBlobDataReader
principalType = "ServicePrincipal"
subscriptionId = data.azurerm_client_config.current.subscription_id
resourceGroupId = azurerm_resource_group.rg.id
}
module "aviRoleBackend" {
source = "./core/security/role"
count = var.enableMultimedia ? 1 : 0
scope = module.video_indexer[0].vi_id
principalId = module.backend.identityPrincipalId
roleDefinitionId = local.azure_roles.Contributor
principalType = "ServicePrincipal"
subscriptionId = data.azurerm_client_config.current.subscription_id
resourceGroupId = azurerm_resource_group.rg.id
}
# // MANAGEMENT SERVICE PRINCIPAL ROLES
module "openAiRoleMgmt" {
source = "./core/security/role"
# If leveraging an existing Azure OpenAI service, only make this assignment if not under automation.
# When under automation and using an existing Azure OpenAI service, this will result in a duplicate assignment error.
count = var.useExistingAOAIService ? var.isInAutomation ? 0 : 1 : 1
scope = var.useExistingAOAIService ? data.azurerm_resource_group.existing[0].id : azurerm_resource_group.rg.id
principalId = module.entraObjects.azure_ad_mgmt_sp_id
roleDefinitionId = local.azure_roles.CognitiveServicesOpenAIUser
principalType = "ServicePrincipal"
subscriptionId = data.azurerm_client_config.current.subscription_id
resourceGroupId = azurerm_resource_group.rg.id
}
module "azMonitor" {
source = "./core/logging/monitor"
logAnalyticsName = module.logging.logAnalyticsName
location = var.location
logWorkbookName = "infoasst-lw-${random_string.random.result}"
resourceGroupName = azurerm_resource_group.rg.name
componentResource = "/subscriptions/${var.subscriptionId}/resourceGroups/${azurerm_resource_group.rg.name}/providers/Microsoft.OperationalInsights/workspaces/${module.logging.logAnalyticsName}"
}
module "kvModule" {
source = "./core/security/keyvault"
name = "infoasst-kv-${random_string.random.result}"
location = var.location
kvAccessObjectId = data.azurerm_client_config.current.object_id
spClientSecret = module.entraObjects.azure_ad_mgmt_app_secret
subscriptionId = var.subscriptionId
resourceGroupId = azurerm_resource_group.rg.id
resourceGroupName = azurerm_resource_group.rg.name
tags = local.tags
}
module "bingSearch" {
source = "./core/ai/bingSearch"
name = "infoasst-bing-${random_string.random.result}"
resourceGroupName = azurerm_resource_group.rg.name
tags = local.tags
sku = "S1" //supported SKUs can be found at https://www.microsoft.com/en-us/bing/apis/pricing
arm_template_schema_mgmt_api = var.arm_template_schema_mgmt_api
keyVaultId = module.kvModule.keyVaultId
enableWebChat = var.enableWebChat
}
// DEPLOYMENT OF AZURE CUSTOMER ATTRIBUTION TAG
resource "azurerm_resource_group_template_deployment" "customer_attribution" {
count = var.cuaEnabled ? 1 : 0
name = "pid-${var.cuaId}"
resource_group_name = azurerm_resource_group.rg.name
deployment_mode = "Incremental"
template_content = <<TEMPLATE
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
TEMPLATE
}