Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alphabetic order from network #166

Open
gvp81 opened this issue Aug 28, 2024 · 1 comment
Open

Alphabetic order from network #166

gvp81 opened this issue Aug 28, 2024 · 1 comment

Comments

@gvp81
Copy link

gvp81 commented Aug 28, 2024

Hello,
First of all, I want to say thank you for your module! Very useful module and I use it!
I have a suggestion.
I see that in new versions of the module when creating a NIC for a virtual machine, they are sorted in alphabetical order.
I think this is not a very good idea.
For example:
I deploy a server with 3 NIC and I want "PortGroup" for "Management-Network" to always be associated with the first interface in the system, ens192.
According to alphabetical sorting, "PortGroup" for "Management-Network" can be either on ens192 or ens256, and so on.
This complicates further use.
For example, there is a software/service that tries to work with ens192 interfaces, considering it "Management-Network", and so on.

Best regards,

@damnsam
Copy link
Contributor

damnsam commented Dec 18, 2024

Use network_delimiter added back in Nov 2023 https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/pull/157, it's in the current version. Two features were added, this would be referencing the second. Basically, if you set the delimiter to some non-used character, it will use the whole string when sorting alphabetically, but use the text after the delimiter to assign the portgroup name to the first/second interface (and so on).

network_delimiter = ":"
network           = { 
  "1:Management-Network" = ["10.1.1.1"],
  "2:Backup-Network"     = ["192.168.1.1"]
}

Now you have it sorted by the numbers, but the portgroup assignment will be Management-Network for the first interface and Backup-Network for the second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants