terraform-lxd / terraform-provider-lxd

LXD Resource provider for Terraform
https://registry.terraform.io/providers/terraform-lxd/lxd/latest/docs
Mozilla Public License 2.0
257 stars 71 forks source link

Support multiple ip addresses on single interface #321

Closed lblasc closed 5 months ago

lblasc commented 1 year ago

We have a setup where two ipv6 subnets are used on single interface, example:

+----------------------+---------+---------------------+---------------------------------------------+-----------+-----------+--------------------+
| vault0               | RUNNING | 10.30.10.49 (eth0)  | fd19:cafe:510:0:216:3eff:fef3:6194 (eth0)   | CONTAINER | 0         | node1              |
|                      |         |                     | 3ac7:ffa:841:7d19:116:4eff:5ef3:1194 (eth0) |           |           |                    |
+----------------------+---------+---------------------+---------------------------------------------+-----------+-----------+--------------------+

lxd_container output will return only one ipv6 address, the public one; the private one won't be returned.

Is it acceptable to convert ip_address, ipv4_address and ipv6_address output type to list so that multiple addresses can be returned ? To preserve compatibility this field can stay as is if only one address is detected.

adamcstephens commented 1 year ago

It would probably be best to create two new attributes, ipv4_addresses and ipv6_addresses that are lists of all the system IPs. This would maintain backward compatibility yet still expose all the addresses.

I'd be happy to review a PR, but may not get to this myself for a while.