【发布时间】:2021-07-11 08:45:15
【问题描述】:
需要使用 Terraform 和 Azure DevOps 实现 VM 扩展。我正在尝试从 .tfvars 传递 fileUris 值或从存储帐户详细信息动态创建 ["https://${var.Storageaccountname}.blob.core.windows .net/${var.containername}/test.sh"],这两种情况都不起作用。
resource "azurerm_virtual_machine_extension" "main" {
name = "${var.vm_name}"
location ="${azurerm_resource_group.resource_group.location}"
resource_group_name = "${azurerm_resource_group.resource_group.name}"
virtual_machine_name = "${azurerm_virtual_machine.vm.name}"
publisher = "Microsoft.Azure.Extensions"
type = "CustomScript"
type_handler_version = "2.0"
settings = <<SETTINGS
{
"fileUris" :"${var.fileUris}",
"commandToExecute": "sh <name of file> --ExecutionPolicy Unrestricted\""
}
SETTINGS
}
关于解决此问题的任何提示?也许其他一些解决方案可以在 main.tf/variable.tf 中实现零硬编码?
【问题讨论】:
-
错误信息是什么?它是 Linux 还是 Windows 虚拟机?
标签: azure azure-storage terraform-provider-azure