如何使用 Terraform 将 PowerShel 模块从库安装到我的 azure 自动化帐户中?
我尝试使用 powershellgallery API url:
resource "azurerm_automation_account" "aac" {
name = var.azure_automation_account_name
location = var.location
tags = var.tags
resource_group_name = var.resource_group
sku_name = "Basic"
}
resource "azurerm_automation_module" "az_accounts" {
name = "az_accounts"
resource_group_name = var.resource_group
automation_account_name = azurerm_automation_account.aac.name
module_link {
uri = "https://www.powershellgallery.com/api/v2/package/az.accounts/2.2.4"
}
}
这总是给我一个错误(我尝试了几个不同版本的模块,没有区别):
Error: Error waiting for Module "az_accounts" (Automation Account "XXX" / Resource Group "YYY") to finish provisioning: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: Cannot import the module of name az_accounts, as the module structure was invalid.
我在这里做错了什么?
一月
最佳答案
模块名称应为“Az.Accounts”
。这对我有用。
resource "azurerm_automation_module" "example" {
name = "Az.Accounts"
resource_group_name = azurerm_resource_group.example.name
automation_account_name = azurerm_automation_account.example.name
module_link {
uri = "https://www.powershellgallery.com/api/v2/package/az.accounts/2.2.4"
}
}
关于azure - Terraform:如何将 PS 模块从库安装到 Azure 自动化中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66041169/