在Azure Gov环境中azurerm_virtual_machine_extension创建过程将永远持续进行

时间:2019-10-14 13:14:16

标签: azure terraform

我想在Linux机器上安装OMS代理,但是创建扩展需要花费很多时间

vm.tf

resource "azurerm_log_analytics_workspace" "workspace" {
  name                = "workspace"
  location            = "${var.azure_location}"
  resource_group_name = "${data.azurerm_resource_group.parent_rg.name}"
  sku                 = "PerGB2018"
  retention_in_days   = 180
}

resource "azurerm_virtual_machine" "server" {
  name                  = "vm"
  vm_size               = "${var.jenkins_vm_size}"
  location              = "${var.azure_location}"
  resource_group_name   = "${azurerm_resource_group.rg.name}"
  network_interface_ids = ["${azurerm_network_interface.nic.id}"]
  ...
  }

  tags = "${local.vm_tags}"
}

resource "azurerm_virtual_machine_extension" "oms_mma" {
  name                       = "OMSExtension"
  location                   = "${var.azure_location}"
  resource_group_name        = "${azurerm_resource_group.rg.name}"
  virtual_machine_name       = "${azurerm_virtual_machine.server.name}"
  publisher                  = "Microsoft.EnterpriseCloud.Monitoring"
  type                       = "OmsAgentForLinux"
  type_handler_version       = "1.7"
  auto_upgrade_minor_version = true

  settings = <<SETTINGS
    {
      "workspaceId" : "${azurerm_log_analytics_workspace.workspace.workspace_id}"
    }
  SETTINGS

  protected_settings = <<PROTECTED_SETTINGS
    {
      "workspaceKey" : "${azurerm_log_analytics_workspace.workspace.primary_shared_key}"
    }
  PROTECTED_SETTINGS
}

Terraform创建过程将继续运行而不会停止:

azurerm_virtual_machine_extension.oms_mma: Still creating... [10s elapsed]
.
.
.
azurerm_virtual_machine_extension.oms_mma: Still creating... [20m0s elapsed]

正如我在MS文档中所读到的那样,对于Azure Gov env,我应该添加-d参数,这意味着该命令的domain,例如:

wget https://raw.githubusercontent.com/Microsoft/OMS-Agent-for-Linux/master/installer/scripts/onboard_agent.sh && sh onboard_agent.sh -w <YOUR WORKSPACE ID> -s <YOUR WORKSPACE PRIMARY KEY> -d opinsights.azure.us

但是我找不到domain参数的terraform脚本的示例。有人有经验吗?

0 个答案:

没有答案