C
Coder.com•2y ago
Kot

Using Docker provider that depends on another

Is there a way for me to specify a provider that depends on another? I want to use Docker to provision a container once I spin up a VM on another provider. Like this:
provider "docker" {
host = "tcp://${fly_machine.machine[0].privateip}:2375"
}
provider "docker" {
host = "tcp://${fly_machine.machine[0].privateip}:2375"
}
Is there any way to do this? When I'm creating the template, Coder spits out: Error: Error initializing Docker client: unable to parse docker host ''
6 Replies
kyle
kyle•2y ago
Unfortunately no 😦 I do believe Terragrunt can do this though: https://terragrunt.gruntwork.io/
Terragrunt | Terraform wrapper
Terragrunt | Terraform wrapper
Terragrunt is a thin wrapper for Terraform that provides extra tools for keeping your Terraform configurations DRY, working with multiple Terraform modules, and managing remote state.
kyle
kyle•2y ago
And we could probably add support for Terragrunt really easily. In fact, I'm pretty sure if you replaced your Terraform binary with Terragrunt (but still named it terraform), Coder would execute it normally.
Kot
Kot•2y ago
Don't think it's a drop-in replacement, template import provision for start: recv import provision: exit status 1 Run 'coder templates create --help' for usage.
Kot
Kot•2y ago
Dean
Dean•2y ago
yeah it's definitely not a drop-in replacement for terraform so we'd have to add support for this feel free to create an issue with your usecase
Kot
Kot•2y ago
GitHub
Terragrunt support · Issue #4381 · coder/coder
One of my providers depends on a resource: provider "docker" { host = "tcp://${fly_machine.machine[0].privateip}:2375" } But this doesn't pass validation...
Want results from more Discord servers?
Add your server