Я пытаюсь использовать ресурс Vsphere_custom_attribute. При первом запуске VSphere он работает нормально, но при втором запуске я получаю сообщение об ошибке ниже.
У вас есть идеи, как это решить? или я просто использовал это неправильно?
Я использую эту версию поставщика Terraform и Vsphere.
Terraform v0.12.12
- provider.template v2.1.2
- provider.vsphere v1.13.0
Это части кода, где я создаю пользовательские атрибуты и где я их использую.
resource "vsphere_custom_attribute" "hostname" {
name = "hypervisor.hostname"
managed_object_type = "VirtualMachine"
}
resource "vsphere_virtual_machine" "vm" {
...
custom_attributes = "${map(vsphere_custom_attribute.hostname.id, "${var.vsphere_name}${var.vsphere_dom}" )}"
...
}
Ошибка:
Error: could not create custom attribute: ServerFaultCode: The name 'hypervisor.hostname' already exists.
on main.tf line 32, in resource "vsphere_custom_attribute" "hostname":
32: resource "vsphere_custom_attribute" "hostname" {
план terraform:
Я не понимаю, почему Terraform хочет создать ему пользовательский атрибут, поскольку он уже существует.
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# vsphere_custom_attribute.hostname will be created
+ resource "vsphere_custom_attribute" "hostname" {
+ id = (known after apply)
+ managed_object_type = "VirtualMachine"
+ name = "hypervisor.hostname"
}