Terraform - 使用参数配置 VM 扩展
Terraform - Provision VM Extensions with Parameters
我正在尝试配置两个 Azure
虚拟机 Extensions
,它们具有与其关联的参数:
- Microsoft 反恶意软件
- 用于 Windows 服务器监控的 Site24x7 代理
我找不到太多文档,但我尝试从 Automation script
下的 Azure 门户中提取数据,以查看它是如何在 JSON 模板中设置的。
resource "azurerm_virtual_machine_extension" "test1" {
name = "IaaSAntimalware"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
virtual_machine_name = "${azurerm_virtual_machine.testapp.name}"
publisher = "Microsoft.Azure.Security"
type = "IaaSAntimalware"
type_handler_version = "1.5.5.1"
auto_upgrade_minor_version = "true"
settings = <<SETTINGS
{
"AntimalwareEnabled": true,
"RealtimeProtectionEnabled": "true",
"ScheduledScanSettings": {
"isEnabled": "true",
"day": "1",
"time": "120",
"scanType": "Quick"
},
"Exclusions": {
"Extensions": "",
"Paths": "",
"Processes": ""
}
}
SETTINGS
tags {
environment = "${var.tag_env}" }
}
Azure Portal Configuration for Antimalware Extension
azurerm_virtual_machine_extension.test1: 1 error(s) occurred:`
azurerm_virtual_machine_extension.test1: compute.VirtualMachineExtensionsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidParameter" Message="The value of parameter typeHandlerVersion is invalid."
有人知道正确的语法吗?
如果您查看 azure-quickstart-templates 的 anti-malware-extension-windows-vm 示例中的 this line:"typeHandlerVersion": "1.1",
您会发现您为版本传递了错误的值。
我正在尝试配置两个 Azure
虚拟机 Extensions
,它们具有与其关联的参数:
- Microsoft 反恶意软件
- 用于 Windows 服务器监控的 Site24x7 代理
我找不到太多文档,但我尝试从 Automation script
下的 Azure 门户中提取数据,以查看它是如何在 JSON 模板中设置的。
resource "azurerm_virtual_machine_extension" "test1" {
name = "IaaSAntimalware"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
virtual_machine_name = "${azurerm_virtual_machine.testapp.name}"
publisher = "Microsoft.Azure.Security"
type = "IaaSAntimalware"
type_handler_version = "1.5.5.1"
auto_upgrade_minor_version = "true"
settings = <<SETTINGS
{
"AntimalwareEnabled": true,
"RealtimeProtectionEnabled": "true",
"ScheduledScanSettings": {
"isEnabled": "true",
"day": "1",
"time": "120",
"scanType": "Quick"
},
"Exclusions": {
"Extensions": "",
"Paths": "",
"Processes": ""
}
}
SETTINGS
tags {
environment = "${var.tag_env}" }
}
Azure Portal Configuration for Antimalware Extension
azurerm_virtual_machine_extension.test1: 1 error(s) occurred:`
azurerm_virtual_machine_extension.test1: compute.VirtualMachineExtensionsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidParameter" Message="The value of parameter typeHandlerVersion is invalid."
有人知道正确的语法吗?
如果您查看 azure-quickstart-templates 的 anti-malware-extension-windows-vm 示例中的 this line:"typeHandlerVersion": "1.1",
您会发现您为版本传递了错误的值。