Support running Terraform from Docker image
I use terraform based on a docker image. Because of that, I have some alias that runs the docker image like I had the terraform installed. Pluralith does not have a way to define a custom path/executable to terraform.
Is it possible to add this option?
Hi @Cussa,
This seems like a pretty straight forward thing, I'm sure we can add it in one of our upcoming CLI releases. So really what you'd need is just a flag to pass in the path where your terraform binary lies, right?
Hello @DanThePutzer
I would say not only where the Terraform command, but command itself. In my case, as I don't have it installed, I would need to inform how to run the Terraform command, which is using docker run.
Hi @Cussa,
Hm, that makes things a bit more complex. We run terraform plan -out and then terraform show -json to get the plan state. We use stdOut of the show command and process that, so technically it should still work no matter where Terraform runs, but there might be a few hiccups I'm not seeing right now.
Could you share some parts of your setup (e.g. the docker image you run Terraform in and the exact commands you use to run it) so we can reproduce it on our end and find a way to make it work? That would be super helpful!
Hello @DanThePutzer !
Sorry for the late reply.
Here is the example:
docker run --rm -it -v $PWD:/data -w /data hashicorp/terraform:light plan
I just need to be on the terraform folder and voilá! Everything works!
@Cussa
Thanks for sharing! We'll look into exposing the option to pass a custom terraform command.
But hold up, regarding that last line of your comment: did you get it to work somehow?
No, it does not.
I mean that this is all I need to do to run the terraform directly from the docker image, without needing to install it.
@Cussa gotcha, that makes sense. We'll look into it and report back when we've got something :)