Problem
When you deploy Terraform Enterprise using Flexible Deployment Options (FDO) on Kubernetes or Docker, the terraform-enterprise container starts and then stops without logging a specific error. The final log entries from the container appear similar to the following output.
[info] [fluent bit] version=2.2.2, commit=, pid=62
[info] [storage] ver=1.5.1, type=memory+filesystem, sync=normal, checksum=off, max_chunks_up=128
[info] [storage] backlog input plugin: storage_backlog.1
[info] [cmetrics] version=0.6.6
[info] [ctraces ] version=0.4.0
[info] [input:tail:tail.0] initializing
[info] [input:tail:tail.0] storage_strategy='memory' (memory only)
[info] [input:storage_backlog:storage_backlog.1] initializing
[info] [input:storage_backlog:storage_backlog.1] storage_strategy='memory' (memory only)
[info] [input:storage_backlog:storage_backlog.1] queue memory limit: 4.8M
[info] [input:emitter:emitter_for_rewrite_tag.0] initializing
[info] [input:emitter:emitter_for_rewrite_tag.0] storage_strategy='memory' (memory only)
[info] [output:stdout:stdout.0] worker #0 started
[info] [http_server] listen iface=0.0.0.0 tcp_port=2020
[info] [sp] stream processor started
[info] [input:tail:tail.0] inotify_fs_add(): inode=4129131 watch_fd=1 name=/var/log/terraform-enterprise/terraform-enterprise.log
[info] [input:tail:tail.0] inotify_fs_add(): inode=4129128 watch_fd=2 name=/var/log/terraform-enterprise/supervisord.log
{"log":"INFO success: terraform-enterprise entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)","component":"supervisord"}
{"log":"INFO stopped: fluent-bit (exit status 0)","component":"supervisord"}
{"log":"INFO spawned: 'fluent-bit' with pid 62","component":"supervisord"}
{"log":"INFO success: fluent-bit entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)","component":"supervisord"}Prerequisites
- An installation of Terraform Enterprise using Flexible Deployment Options (FDO).
Cause
This issue can occur if the environment variables for external services, such as TFE_REDIS_HOST or TFE_DATABASE_HOST, are configured with an invalid DNS hostname. When Terraform Enterprise cannot resolve the hostname to an IP address during startup, the container may exit without logging a clear error message.
Solutions
Solution 1: Verify DNS Resolution for External Services
Ensure that all hostnames configured for Terraform Enterprise external services are valid and resolvable from within the container's environment.
-
Use a command like
nslookupto test the DNS resolution for the hostnames you provided.A successful lookup returns an IP address.
$ nslookup hashicorp.com ## Server: 192.168.0.1 ## Address: 192.168.0.1#53 ## ## Non-authoritative answer: ## Name: hashicorp.com ## Address: 76.76.21.21
An unsuccessful lookup results in an error, such as
NXDOMAIN.$ nslookup this_does_not_exist.hashicorp.com ## Server: 192.168.0.1 ## Address: 192.168.0.1#53 ## ** server can't find this_does_not_exist.hashicorp.com: NXDOMAIN
- If DNS resolution fails, correct the hostname in your Terraform Enterprise configuration and redeploy the container.
Outcome
After you provide valid DNS hostnames for all external services, the Terraform Enterprise container should start successfully and display startup checks in the logs.
{"log":"[INFO] terraform-enterprise: build info: release=v202405-1 sha=86aa5cb","component":"terraform-enterprise"}
{"log":"[INFO] terraform-enterprise: version: current=v202405-1","component":"terraform-enterprise"}
{"log":"[INFO] terraform-enterprise: check passed: name=config duration=\"83.938µs\"","component":"terraform-enterprise"}
{"log":"[INFO] terraform-enterprise: check passed: name=database duration=37.645442ms","component":"terraform-enterprise"}
{"log":"[INFO] terraform-enterprise: check passed: name=disk duration=\"40.342µs\"","component":"terraform-enterprise"}
{"log":"[INFO] terraform-enterprise: check passed: name=license duration=\"837.128µs\"","component":"terraform-enterprise"}
{"log":"[INFO] terraform-enterprise: check passed: name=redis duration=4.415006ms","component":"terraform-enterprise"}
{"log":"[INFO] terraform-enterprise: check passed: name=tls duration=\"143.678µs\"","component":"terraform-enterprise"}
{"log":"[INFO] terraform-enterprise: check passed: name=upgrade duration=48.915626ms","component":"terraform-enterprise"}Additional Information
- For a complete list of configuration parameters, refer to the Terraform Enterprise Flexible Deployment Options configuration documentation.