Azure Automation account and runbook creation using Terraform

Copper Contributor

Hi Team,

 

I'm stuck at creating " PowerShell workflow " runbook using Terrafrom, as shown below I placed my PS runbook script in the module and unable to create it from Azure devops, Kindly could you help me

 
data "local_file" "example" {
  filename = "../modules/automation/scripts/PauseSynapseDW.ps1"
}
 
resource "azurerm_automation_account" "automationaccount" {
  name                = var.autoaccount
  resource_group_name          = var.resource_group_name
  location                     = var.location
  sku_name = "Basic"
}

resource "azurerm_automation_runbook" "runbookcreation" {
  name                    = "PauseSynapseDW"
  resource_group_name          = var.resource_group_name
  location                     = var.location
  automation_account_name = azurerm_automation_account.automationaccount.name
  log_verbose             = "true"
  log_progress            = "true"
  description             = "This is an example runbook"
  runbook_type            = "PowerShellWorkflow"
  content = data.local_file.example.content
    publish_content_link {
  }
}
 
"following is the error from Azure devops "
/*
data "local_file" "example" {
  filename = "../modules/automation/scripts/PauseSynapseDW.ps1"
}
*/

resource "azurerm_automation_account" "automationaccount" {
  name                = var.autoaccount
  resource_group_name          = var.resource_group_name2
  location                     = var.location
  sku_name = "Basic"
}

resource "azurerm_automation_runbook" "runbookcreation" {
  name                    = "SuspendOrPauseAzureSQLDataWarehouse"
  resource_group_name          = var.resource_group_name2
  location                     = var.location
  automation_account_name = azurerm_automation_account.automationaccount.name
  log_verbose             = "true"
  log_progress            = "true"
  description             = "This is an example runbook"
  runbook_type            = "PowerShellWorkflow"
  #content = data.local_file.example.content
    publish_content_link {
  }
}
Please find the following error 
 
 

 

0 Replies