Skip to content

Commit

Permalink
Add deploy_bing variable to cog module
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Mar 7, 2024
1 parent 5a88e3b commit 37b81f2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ module "cog" {
content_safety_name = local.content_safety_name
speech_name = local.speech_name
content_safety_storage_resource_id = module.st.storage_account_id
deploy_bing = var.deploy_bing
}

module "cae" {
Expand Down
3 changes: 2 additions & 1 deletion infra/modules/cog/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ resource "azurerm_cognitive_account" "speech" {
}

resource "azurerm_resource_group_template_deployment" "main" {
name = var.bing_name
count = var.deploy_bing ? 1 : 0
name = "${var.bing_name}-${uuid()}"
resource_group_name = var.resource_group_name
deployment_mode = "Incremental"
parameters_content = jsonencode({
Expand Down
4 changes: 2 additions & 2 deletions infra/modules/cog/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ output "speech_key" {
}

output "bing_key" {
value = jsondecode(azurerm_resource_group_template_deployment.main.output_content).accessKeys.value.key1
}
value = var.deploy_bing ? jsondecode(azurerm_resource_group_template_deployment.main.output_content).accessKeys.value.key1 : ""
}
1 change: 1 addition & 0 deletions infra/modules/cog/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ variable "content_safety_name" {}
variable "cognitive_services_name" {}
variable "speech_name" {}
variable "bing_name" {}
variable "deploy_bing" {}
variable "content_safety_storage_resource_id" {}
4 changes: 4 additions & 0 deletions infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ variable "enable_apim" {
default = false
}

variable "deploy_bing" {
default = false
}

variable "pbi_report_link" {
default = ""
}

0 comments on commit 37b81f2

Please sign in to comment.