terraform-provider-azurerm: Error setting the draft Automation Runbook, azurerm_automation_runbook fails with 404 Error - Unless Published version of runbook already exists
Terraform Configuration Files
resource "azurerm_resource_group" "example" {
name = "loggingRG"
location = "eastus2"
}
resource "azurerm_automation_account" "example" {
name = "testaccount"
location = "${azurerm_resource_group.example.location}"
resource_group_name = "${azurerm_resource_group.example.name}"
sku {
name = "Basic"
}
}
data "local_file" "example" {
filename = "${path.module}/Users/testuser/tftest/Conncetionscript.ps1"
}
resource "azurerm_automation_runbook" "example" {
name = "Conncetionscript"
location = "${azurerm_resource_group.example.location}"
resource_group_name = "${azurerm_resource_group.example.name}"
account_name = "${azurerm_automation_account.example.name}"
log_verbose = "true"
log_progress = "true"
description = "testing tf template"
runbook_type = "PowerShell"
depends_on = ["azurerm_automation_account.example"]
publish_content_link {
uri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1"
}
content = "${data.local_file.example.filename}"
}
Debug Output
- azurerm_automation_runbook.runbook_start: Error setting the draft Automation Runbook automation.RunbookDraftClient#ReplaceContent: Failure sending request: StatusCode=404 – Original Error: Code=“ResourceNotFound” Message=“The Resource ‘Microsoft.Automation/automationAccounts/testaccount/runbooks/Conncetionscript’ under resource group ‘loggingRG’ was not found.” "
Expected Behavior Runbook should be created
Actual Behavior Looking for creating runbook which doesn’t exist
Steps to Reproduce terraform apply
Terraform Version Terraform v0.12.7
- provider.azurerm v1.34.0
- provider.local v1.3.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 15 (3 by maintainers)
Yeah, for MR #3386 I’ve noticed that this started happening. This is due to the fact that MS basically removed the file the examples and tests were pointing to.
If you are using the content parameter, a workaround is to point the url to any location as long as it exists. Even something like
http://google.com/
works.Hi @draggeta, I can’t reproduce that it has anything to do with thepublish_content_link
. Creating a new runbook just always fails, period.As far as I can see this is just a failure of terraform to perform the correct AzureRM operations.I just retried this and it seems I was wrong. I must’ve made a mistake when running apply.
i ran into this today with the both the regular and custom content examples listed in the documentation.