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

user.access_interface is not inherited from profiles #448

Closed jon-hedgerows closed 8 months ago

jon-hedgerows commented 8 months ago

I've found some unexpected behaviour, possibly a bug.

I have an lxd instance which ends up with multiple interfaces and multiple IP addresses, and as expected terraform fails to return the 'correct' IP address for the instance. Setting user.access_interface helps the terraform provider identify the correct IP.

If I specify user.access_interface as part of the instance config, then terraform correctly identifies the instance's IP address based on that interface and everything works as expected.

However, if I specify user.access_interface in a profile, for example alongside the definition of a network device, then terraform fails to consider it and returns the wrong IP. In lxd, the value is inherited as part of the expanded configuration, e.g. lxc config get instancename user.access_interface -e returns the value set in the profile (or overridden, per the rules in lxd).

Expected behaviour is that terraform considers the expanded configuration when determining the value of user.access_interface, following the same principles as lxd, and allowing the value to be inherited through profiles.

MusicDin commented 8 months ago

Thanks for reporting this, will take a look at this asap