通过Terraform代码创建Azure Automation帐户运行时获得不良请求错误
我正在通过Terraform代码创建一本简单的运行书。 Below is the code that I am using:
resource "azurerm_automation_runbook" "example" {
name = "AzureVMslist"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
automation_account_name = azurerm_automation_account.example.name
log_verbose = "true"
log_progress = "true"
description = "This is an example runbook"
runbook_type = "PowerShell"
publish_content_link {
uri = "" #not mentioning my uri
}
}
terraform plan is successful and when I ran terraform apply then getting below:
azurerm_automation_runbook.example:创建...
错误:创建 /更新runbook :(名称为“ azurevmslist” / automation帐户名称“ automation123” / resource group“ poc_terraform”):automation.runbookclient#creationorupdate:creationorupdate:faility to reverts to request = 400- statuscode = 400-原始错误:outorest-原始错误:自动错误:自动/azure:服务返回错误。 status = 400代码=“ badrequest” message =“ {” message“:”指定的无效参数。参数内容不能为null。”}“
How can we fix this error?
I am creating a simple runbook through the terraform code. Below is the code that I am using:
resource "azurerm_automation_runbook" "example" {
name = "AzureVMslist"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
automation_account_name = azurerm_automation_account.example.name
log_verbose = "true"
log_progress = "true"
description = "This is an example runbook"
runbook_type = "PowerShell"
publish_content_link {
uri = "" #not mentioning my uri
}
}
terraform plan is successful and when I ran terraform apply then getting below:
azurerm_automation_runbook.example: Creating...
Error: creating/updating Runbook: (Name "AzureVMslist" / Automation Account Name "automation123" / Resource Group "poc_terraform"): automation.RunbookClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="{"Message":"Invalid argument specified. Argument content cannot be null."}"
How can we fix this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了这个问题并且已经解决了。该问题是由于我们用于publish_content_link 的虚拟/空uri 造成的。因此,我们需要使用 Valid uri,以便自动创建 Runbook。
我通过获取一个示例 powershell 脚本文件解决了这个问题,并且在代码中使用了该文件。
我们使用 content = data.local_file.example.content 而不是在代码中发布内容。
I found the issue and I have fixed it. The issue is because of the dummy/empty uri that we are using for publish_content_link. So we need to use the Valid uri so that the runbook will get create automatically.
I have fixed this issue by taking one sample powershell script file and I have used that file in the code.
and we have use the content = data.local_file.example.content instead of publish the content in the code.