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

Make stream-analytics-job module optional #128

Merged
merged 1 commit into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 7 additions & 8 deletions terraform/stream-analytics/stream-analytics-job/main.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/stream_analytics_job

resource "azurerm_stream_analytics_job" "adl_asa" {
name = "asa-${var.basename}"
resource_group_name = var.rg_name
location = var.location

name = "asa-${var.basename}"
resource_group_name = var.rg_name
location = var.location
compatibility_level = var.compatibility_level
data_locale = var.data_locale
events_late_arrival_max_delay_in_seconds = var.events_late_arrival_max_delay_in_seconds
events_out_of_order_max_delay_in_seconds = var.events_out_of_order_max_delay_in_seconds
events_out_of_order_policy = var.events_out_of_order_policy
output_error_policy = var.output_error_policy
streaming_units = var.streaming_units

tags = var.tags

transformation_query = <<QUERY
transformation_query = <<QUERY
SELECT *
INTO [YourOutputAlias]
FROM [YourInputAlias]
QUERY
tags = var.tags

count = var.module_enabled ? 1 : 0
}
15 changes: 12 additions & 3 deletions terraform/stream-analytics/stream-analytics-job/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
output "id" {
value = azurerm_stream_analytics_job.adl_asa.id
value = (
length(azurerm_stream_analytics_job.adl_asa) > 0 ?
azurerm_stream_analytics_job.adl_asa[0].id : ""
)
}

output "name" {
value = azurerm_stream_analytics_job.adl_asa.name
value = (
length(azurerm_stream_analytics_job.adl_asa) > 0 ?
azurerm_stream_analytics_job.adl_asa[0].name : ""
)
}

output "resource_group_name" {
value = azurerm_stream_analytics_job.adl_asa.resource_group_name
value = (
length(azurerm_stream_analytics_job.adl_asa) > 0 ?
azurerm_stream_analytics_job.adl_asa[0].resource_group_name : ""
)
}
6 changes: 6 additions & 0 deletions terraform/stream-analytics/stream-analytics-job/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ variable "tags" {
description = "A mapping of tags which should be assigned to the deployed resource."
}

variable "module_enabled" {
type = bool
description = "Variable to enable or disable the module."
default = true
}

variable "compatibility_level" {
type = string
description = "Specifies the compatibility level for this job - which controls certain runtime behaviours of the streaming job."
Expand Down