无法使用Terraform上传多个Runbook文件到Azure自动化帐户
我在Terraform的帮助下创建了Azure Automation帐户,并且我拥有现有的Runbook PowerShell脚本,我需要将其导入到Azure Automation帐户中。我正在尝试在Terraform中的for-EAPL循环,以便在时间上上传多个脚本,但是它不起作用:
代码:
resource "azurerm_automation_runbook" "example" {
for_each = fileset(",", "./Azure_Runbooks/*.ps1")
name = split("/", each.value)[1]
location = var.location
resource_group_name = var.resource_group
automation_account_name = azurerm_automation_account.example.name
log_verbose = var.log_verbose
log_progress = var.log_progress
runbook_type = var.runbooktype
content = filemd5("${each.value}")
}
执行Terraform时,它没有显示任何错误,但并未导入我本地中的所有脚本。请建议我如何导入多个PowerShell脚本文件上传到Azure自动化帐户。
I have created azure automation account with the help of terraform and I have existing runbook PowerShell scripts which I need to import to azure automation account. I am trying for-each loop in the terraform to upload multiple scripts at time but it is not working:
Code:
resource "azurerm_automation_runbook" "example" {
for_each = fileset(",", "./Azure_Runbooks/*.ps1")
name = split("/", each.value)[1]
location = var.location
resource_group_name = var.resource_group
automation_account_name = azurerm_automation_account.example.name
log_verbose = var.log_verbose
log_progress = var.log_progress
runbook_type = var.runbooktype
content = filemd5("${each.value}")
}
while executing the terraform it is not showing any errors but it is not importing all the scripts which is there in my local. Please suggest me how I can import multiple PowerShell script files to upload to Azure automation account.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们可以使用这样的代码来解决您的问题。
上面的文件集语法将将所有脚本文件导入Azure自动化帐户。
We can use code like this to solve your issue.
above fileset syntax will import all the script files to azure automation account.