jtopjian / terraform-provider-lxc

Terraform Provider Plugin for LXC
43 stars 6 forks source link

Few bugfixes and add a exec option to container #6

Closed theredcat closed 8 years ago

theredcat commented 8 years ago

Add a "exec" parameter to resource_lxc_container to exec bootstrap commands via LXC go library.

This allow the use of community image that doesn't take a ssh-key paramerter and don't install ssh server, like the debian jessie default image

I'm using it that way :

resource "lxc_container" "infra-01" {
        [...]
        exec = [
                "mkdir -p /root/.ssh",
                "bash -c \"echo '${file(\"${path.module}/infra.key.pub\")}' > /root/.ssh/authorized_keys\"",
                "apt-get update",
                "apt-get --yes -q install openssh-server"
        ]
}
jtopjian commented 8 years ago

Nice! Thank you for this.

I noticed a typo in the code. I fixed it locally and everything works great. If you want to quickly fix it, I'll merge everything after that :smile:

theredcat commented 8 years ago

Yes I've noticed that. Just forgot to do & push my last change :D

By the way, Very nice work! I've first thought to implement a ForceNew killer mechanism on few options, but at the moment I don't think I'll have the time to write it.

theredcat commented 8 years ago

And added option on doc

jtopjian commented 8 years ago

All looks good! Thanks!