I have two terraform modules :
- docker_server: provisions a VM on Oracle Cloud and configures docker on it
- docker_service: needs to take the provisioned VM ip to provision container on it using ssh
I’m also managing multiple Oracle Cloud Account (Provisioned VMs are within the always free tier).
Here’s my directory hierarchy :
└── terraform
└── docker_servers
└── account_1
└── docker_server.yaml
└── terragrunt.hcl
└── account_2
└── docker_server.yaml
└── terragrunt.hcl
└── common.hcl
└── docker_services
└── influxdb
└── docker_service.yaml
└── terragrunt.hcl
└── common.hcl
└── modules
└── terragrunt_templates
└── terragrunt.hcl
On docker_services/common.hcl
I have the following dependency to docker_servers
:
dependency "docker_server" {
config_path = "${get_terragrunt_dir()}/../../docker_servers/${local.docker_service.server}"
}
When I run terragrunt run-all plan
I get this error :
* /home/ares/dev/rust/profit_prophet/infrastructure/terraform/docker_servers/account_1/terragrunt.hcl is a dependency of /home/ares/dev/rust/profit_prophet/infrastructure/terraform/docker_services/influxdb/terragrunt.hcl but detected no outputs. Either the target module has not been applied yet, or the module has no outputs. If this is expected, set the skip_outputs flag to true on the dependency block.
And When I add the following to the dependency:
mock_outputs = {
ip = "127.0.0.1"
privatekey = "not so private"
}
It tries to ping the docker server, so I get this error:
│ Error: Error pinging Docker server: error during connect: Get "http://docker.example.com/_ping": command [ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i not so private -- 127.0.0.1 docker system dial-stdio] has exited with exit status 255, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=Warning: Identity file not so private not accessible: No such file or directory.
│ ssh: connect to host 127.0.0.1 port 22: Connection refused
│
│
│ with provider["registry.terraform.io/kreuzwerker/docker"],
│ on provider.tf line 11, in provider "docker":
│ 11: provider "docker" {
│
╵
Is there any way to achieve what I’m trying to do ?