Skip to content

Commit

Permalink
Add Trigger start and pipeline start for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinbuss committed May 15, 2024
1 parent d0451f0 commit 31caf23
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
24 changes: 24 additions & 0 deletions code/infra/datafactory_content.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,27 @@ resource "azurerm_resource_group_template_deployment" "data_factory_content_depl
parameters_content = jsonencode(jsondecode(templatefile(var.data_factory_published_content.parameters_file, local.data_factory_published_content_template_variables)).parameters)
template_content = file(var.data_factory_published_content.template_file)
}

resource "null_resource" "data_factory_triggers_start" {
for_each = toset(var.data_factory_triggers_start)

provisioner "local-exec" {
command = "az datafactory trigger start --resource-group ${azurerm_data_factory.data_factory.resource_group_name} --factory-name ${azurerm_data_factory.data_factory.name} --name ${each.value}"
}

depends_on = [
azurerm_resource_group_template_deployment.data_factory_content_deployment
]
}

resource "null_resource" "data_factory_pipelines_run" {
for_each = toset(var.data_factory_pipelines_run)

provisioner "local-exec" {
command = "az datafactory pipeline create-run --resource-group ${azurerm_data_factory.data_factory.resource_group_name} --factory-name ${azurerm_data_factory.data_factory.name} --name ${each.value}"
}

depends_on = [
azurerm_resource_group_template_deployment.data_factory_content_deployment
]
}
14 changes: 14 additions & 0 deletions code/infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ variable "data_factory_published_content_template_variables" {
default = {}
}

variable "data_factory_triggers_start" {
description = "Specifies the list of trigger names that should be started after the deployment."
type = list(string)
sensitive = false
default = []
}

variable "data_factory_pipelines_run" {
description = "Specifies the list of pipeline names that should be started after the deployment."
type = list(string)
sensitive = false
default = []
}

variable "kusto_cluster_sku" {
description = "Specifies the kusto cluster sku name."
type = object({
Expand Down
8 changes: 8 additions & 0 deletions code/infra/vars.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ data_factory_published_content = {
template_file = "../../sc4-dev-df001/ARMTemplateForFactory.json"
}
data_factory_published_content_template_variables = {}
data_factory_triggers_start = [
"IptvUpload",
"OttUpload",
"Reference"
]
data_factory_pipelines_run = [
"ReferenceMainPipeline"
]
kusto_cluster_sku = {
name = "Standard_E2ads_v5",
capacity = 2
Expand Down
8 changes: 8 additions & 0 deletions config/SharedTenant/vars.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ data_factory_published_content = {
# template_file = "../sample/ARMTemplateForFactory.json"
}
data_factory_published_content_template_variables = {}
data_factory_triggers_start = [
"IptvUpload",
"OttUpload",
"Reference"
]
data_factory_pipelines_run = [
"ReferenceMainPipeline"
]
kusto_cluster_sku = {
name = "Standard_E2ads_v5",
capacity = 2
Expand Down

0 comments on commit 31caf23

Please sign in to comment.