无法使用Terraform上传多个Runbook文件到Azure自动化帐户

发布于 2025-01-25 16:03:26 字数 770 浏览 5 评论 0原文

我在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若有似无的小暗淡 2025-02-01 16:03:26

我们可以使用这样的代码来解决您的问题。

for_each = fileset("Azure_Runbooks/", "*")

上面的文件集语法将将所有脚本文件导入Azure自动化帐户。

We can use code like this to solve your issue.

for_each = fileset("Azure_Runbooks/", "*")

above fileset syntax will import all the script files to azure automation account.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文