使用azurerm_dev_test_global_vm_shutdown_schedule时出现“ID缺少"虚拟机”元素“错误

e0bqpujr  于 2023-02-16  发布在  其他
关注(0)|答案(1)|浏览(68)

我设置了Azure虚拟机规模,并希望通过azurerm_dev_test_global_vm_shutdown_schedule资源计划虚拟机关闭。但我认为它在尝试获取virtual_machine_id时抛出了以下错误。有人遇到过类似的问题吗?

resource "azurerm_dev_test_global_vm_shutdown_schedule" "vm_shutdown" {
  virtual_machine_id = azurerm_linux_virtual_machine_scale_set.vmss.id
  location           = data.azurerm_resource_group.rg.location
  enabled            = true
  depends_on         = [azurerm_linux_virtual_machine_scale_set.vmss]

  daily_recurrence_time = "2000"
  timezone              = "Central Europe Standard Time"

  notification_settings {
    enabled         = true

  }
 }

我在Terraform计划期间收到以下错误:
错误:ID缺少virtualMachines元素│ │带有azurerm_dev_test_global_vm_shutdown_schedule.vm_shutdown,│位于04_linux_virtual_machine_scale_set. tf第57行,资源“azurerm_dev_test_global_vm_shutdown_schedule”“vm_shutdown”中:│ 57:虚拟机标识= azurerm_linux_virtual_machine_scale_set.vmss.id

f3temu5u

f3temu5u1#

对于virtual_machine_id,您必须使用azurerm_linux_virtual_machine的ID,而不是azurerm_linux_virtual_machine_scale_set

相关问题