I am trying to create a container on LXD environment which is deployed over a linux ubuntu 20.04 using terraform which is installed on my local laptop and I am trying to connect my terraform host to LXD server, can any one please let me know how do I run the terraform code remotely to LXD server.
FYI, there is a bug with the terraform-lxd provider (that I have yet to report) where it tries to look for your credentials only in ~/.config/lxc. If you are using the snap, that location won’t exist or have the needed bits so you need to workaround it with this symlink:
ln -s ~/snap/lxd/common/config/ ~/.config/lxc
This way, your existing client.key, client.crt and all your remotes and their crt will be found by terraform without needing to specify them.
Here’s my main.tf that’s using a LXD remote named xeon:
Thank you for the response @sdeziel, let me clarify the whole scenario.
LXD Server installed on Ubuntu, and I am trying to push the code from my local windows system to LXD Server to create a container. Could you please guide me how do I create and where to create “client.crt and client.key” for remote connection, as I am little bit confused, should I need to install lxc client on my windows machine and then create a symlink respect of “ln -s ~/snap/lxd/common/config/ ~/.config/lxc” this.
If I am directly running the terraform code from LXD Server everything works smooth and container, profile etc are created successfully.
Sorry, I assumed a linux client running the snap. Obviously I was wrong so please disregard my suggestion. As for how to do what you want from a Windows client, I’m afraid I don’t know how, sorry.
Maybe @stgraber would know some more about lxc on Windows?