Problem
After migrating Terraform Enterprise from a Replicated installation to the Docker flexible deployment option, Terraform runs are stuck in a queued status and do not proceed.
Prerequisites
- An installation of Terraform Enterprise.
- You have followed the guide for Migrating from Replicated to Docker.
Cause
A Replicated deployment of Terraform Enterprise automatically creates a Docker network named tfe_terraform_isolation for the tfe-agents to use. When migrating to the Docker flexible deployment option, this network must be created manually. If it is missing, the task-worker container will fail to start, preventing runs from being processed.
You can confirm this issue by reviewing the Terraform Enterprise application startup logs.
$ docker logs -f terraform-enterprise-tfe-1
Look for an error indicating the network is not found.
{"component":"task-worker","log":"Error response from daemon: network tfe_terraform_isolation not found"}
INFO exited: task-worker (exit status 1; not expected)
{"component":"supervisord","log":"INFO exited: task-worker (exit status 1; not expected)"}This log output verifies that the Docker network tfe_terraform_isolation, specified by the TFE_RUN_PIPELINE_DOCKER_NETWORK variable, does not exist. This causes the task-worker process to exit.
Additionally, the sidekiq logs may show errors indicating an inability to connect to the task-worker.
[ERROR] msg=Failed to dispatch AgentJob agent_job_id=1400 workload_type=Plan workload_id=899 exception=Failed to open TCP connection to 127.0.0.1:8000 (Connection refused - connect(2) for "127.0.0.1" port 8000)
Solutions
You can resolve this issue with one of the following solutions.
Solution 1: Reconfigure Terraform Enterprise
This solution removes the requirement for the custom Docker network, allowing Terraform Enterprise to use the default network.
-
Stop the Terraform Enterprise application.
$ docker compose down
- Edit the
docker-compose.ymlfile and remove theTFE_RUN_PIPELINE_DOCKER_NETWORKenvironment variable. -
Save the changes and deploy the application again.
$ docker compose up --detach
Solution 2: Create the Missing Docker Network
This solution creates the Docker network that Terraform Enterprise is configured to use.
-
Stop the Terraform Enterprise application.
$ docker compose down
-
Create the Docker network with the expected name.
$ docker network create tfe_terraform_isolation
-
Redeploy the Terraform Enterprise application.
$ docker compose up --detach
Outcome
After applying one of the solutions, the task-worker container will start correctly, and Terraform runs will proceed as expected.