2

我正在尝试将 OMS VM 扩展添加到 linux 机器,但它只是在部署过程中无休止地等待。运行 terraform 计划时没有错误。我在 terraform 中使用以下代码和 VM 创建代码。任何线索在这里发生了什么您可以在此处找到相应的 powershell 和 CLI 脚本 https://docs.microsoft.com/en-us/azure/virtual-machines /扩展/oms-linux

resource "azurerm_virtual_machine_extension" "test" {
  name                 = "${azurerm_virtual_machine.test.name}/OmsExtension"
  location             = "${azurerm_resource_group.test.location}"
  resource_group_name  = "${azurerm_resource_group.test.name}"
  virtual_machine_name = "${azurerm_virtual_machine.test.name}"
  publisher            = "Microsoft.EnterpriseCloud.Monitoring"
  type                 = "OmsAgentForLinux"
  type_handler_version = "1.4"


  settings = <<SETTINGS
      {
          "workspace ID" : "XXXX",
      }
  SETTINGS

    protected_settings = <<PROTECTED_SETTINGS
      {
          "workspace key" :  "XXXX"
      }
  PROTECTED_SETTINGS
}
4

1 回答 1

4

乍一看,您的工作区密钥和 ID“密钥”似乎不正确,两个密钥似乎都没有空格。Azure 应该提供更好的错误,例如提供的无效密钥。

我能够使用 Terraform 成功配置,它确实失败了几次,但它成功地使用了这个配置。

resource "azurerm_virtual_machine_extension" "oms_mma" {
 name                          = "OMSExtension"
 location                      = "${var.vm_location}"
 resource_group_name           = "${var.resource_group_name}"
 virtual_machine_name          = "${var.vm_machine_name}"
 publisher                     = "Microsoft.EnterpriseCloud.Monitoring"
 type                          = "OmsAgentForLinux"
 type_handler_version          = "1.6"
 auto_upgrade_minor_version    = "True"

 settings = <<-BASE_SETTINGS
 {
   "workspaceId" : "myid"
 }
 BASE_SETTINGS

 protected_settings = <<-PROTECTED_SETTINGS
 {
   "workspaceKey" : "mykey"
 }
 PROTECTED_SETTINGS
}
于 2018-08-14T14:52:27.090 回答