Hi team,
This request comes from the following thread #1711
From powershell it is possible to link runbooks with a schedule created in an automation account, as suggested @holmesb.
With terraform I can not find any resource that can do it.
To be able to close the minimum cycle of possibilities that an automation account allows, I think it is necessary to have this resource available,
:(
I was a bit curious why this wasn't supported, as well. I suppose the best we can do at this point, is to add a :+1: and a me too
I've had a go at fleshing out the required resource.
resource "azurerm_automation_job_schedule" "example" {
name = "${azurerm_automation_schedule.my_schedule.name}"
runbook = "${azurerm_automation_runbook.my_runbook.name}"
parameters {
foo = "bar"
baz = "thing"
}
}
parameters is optional and could potentially be called runbook_parametersjobScheduleId could be an attribute of the resource.Subscribed to get to know when will be available. Very useful feature.
Opened a PR to add this resource as I'm needing this (and a few other automation resources) myself.
Watching this one closely as this would be a very useful addition to the automation suite.
Also watching for a solution for this issue
@odee30 @ @Matasiete this is currently blocked on an upstream issue with the API
That's a shame. Thanks for checking it out @katbyte
As a workaround, I have used "azurerm_template_deployment" resource to implement this functionality, here is a code that works completely fine for me:
resource "random_uuid" "test" { }
resource "azurerm_template_deployment" "template_deployment" {
name = "DeploymentTemplateName"
resource_group_name = "${data.azurerm_resource_group.example.name}"
deployment_mode = "Incremental"
template_body = <<DEPLOY
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Automation/automationAccounts/jobSchedules",
"apiVersion": "2015-10-31",
"name": "${azurerm_automation_account.example.name}/${random_uuid.test.result}",
"properties": {
"runbook": {
"name": "${azurerm_automation_runbook.example.name}"
},
"schedule": {
"name": "${azurerm_automation_schedule.hour.name}"
}
}
}
]
}
DEPLOY
}
Do let me know if this helps!
Cheers!
In addition to what @pranavdesai1900 has posted, if it happens that you get an error like this one:
404 - File or directory not found. Server Error
Is probably because you want to use a fancy name for the resource. This Azure API really likes this form (with the uuid):
"name": "${azurerm_automation_account.example.name}/${random_uuid.test.result}",
This has been released in version 1.36.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:
provider "azurerm" {
version = "~> 1.36.0"
}
# ... other configuration ...
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!
Most helpful comment
As a workaround, I have used "azurerm_template_deployment" resource to implement this functionality, here is a code that works completely fine for me:
Do let me know if this helps!
Cheers!