Terraform - 使用参数提供VM扩展

时间:2018-02-20 21:55:14

标签: azure azure-virtual-machine terraform terraform-provider-azure

我试图配置两个Azure虚拟机Extensions,它们具有与之关联的参数:

  1. Microsoft Antimalware
  2. Site24x7 Windows服务器监控代理
  3. 我找不到太多文档,但我尝试从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个错误:`

         

    azurerm_virtual_machine_extension.test1:compute.VirtualMachineExtensionsClient#CreateOrUpdate:发送请求失败:StatusCode = 400 - 原始错误:autorest / azure:服务返回错误。状态= 400代码=&#34; InvalidParameter&#34;消息=&#34;参数typeHandlerVersion的值无效。&#34;

    有谁知道正确的语法?

1 个答案:

答案 0 :(得分:0)

如果您在azure-quickstart-templates的反恶意软件扩展程序-windows-vm样本中查看this line"typeHandlerVersion": "1.1",,您会看到您为该版本传递了错误的值。< / p>