1
votes

impossible de sortir l'adresse Mac lors du provisionnement de plusieurs VM

donc j'essaye de déployer plusieurs vm mais quand j'essaye de sortir l'adresse mac, cela échoue avec

output.mac: Ressource 'vsphere_virtual_machine.vm' introuvable pour la variable 'vsphere_virtual_machine.vm.network_interface.0. mac_address '

quelqu'un peut-il me dire pourquoi il échoue ou ce qui ne va pas dans mon code.


0 commentaires

3 Réponses :


1
votes

Il n'y a pas de référence d'attribut "network_interface" pour la ressource "vsphere_virtual_machine". Vous ne pouvez donc pas afficher les détails de l'interface réseau. Veuillez consulter le lien du document de ressources https://www.terraform.io/docs /providers/vsphere/r/virtual_machine.html .

Following attributes are exported on the base level of this resource:

id - The UUID of the virtual machine.
reboot_required - Value internal to Terraform used to determine if a configuration set change requires a reboot. This value is only useful during an update process and gets reset on refresh.
vmware_tools_status - The state of VMware tools in the guest. This will determine the proper course of action for some device operations.
vmx_path - The path of the virtual machine's configuration file in the VM's datastore.
imported - This is flagged if the virtual machine has been imported, or the state has been migrated from a previous version of the resource. It influences the behavior of the first post-import apply operation. See the section on importing below.
change_version - A unique identifier for a given version of the last configuration applied, such the timestamp of the last update to the configuration.
uuid - The UUID of the virtual machine. Also exposed as the id of the resource.
default_ip_address - The IP address selected by Terraform to be used with any provisioners configured on this resource. Whenever possible, this is the first IPv4 address that is reachable through the default gateway configured on the machine, then the first reachable IPv6 address, and then the first general discovered address if neither exist. If VMware tools is not running on the virtual machine, or if the VM is powered off, this value will be blank.
guest_ip_addresses - The current list of IP addresses on this machine, including the value of default_ip_address. If VMware tools is not running on the virtual machine, or if the VM is powered off, this list will be empty.
moid: The managed object reference ID of the created virtual machine.
vapp_transport - Computed value which is only valid for cloned virtual machines. A list of vApp transport methods supported by the source virtual machine or template.


0 commentaires

0
votes

Si quelqu'un est intéressé, cela fonctionne pour moi :)

output "mac"{
value ="${vsphere_virtual_machine.vm.network_interface[0].mac_address}"
}


0 commentaires

0
votes

sur un Terraform plus ancien (0.11.8), j'ai dû utiliser:

output "mac"{
value ="${vsphere_virtual_machine.vm.network_interface.0.mac_address}"
}


0 commentaires