Introduction
This document describes how you can easily connect to your PostgreSQL environment using the connection string defined by the Terraform Enterprise container.
Prerequisites
- Ability to access the Terraform Enterprise container
Use Case
Replicated non-consolidated
sudo docker exec -ti tfe-atlas /bin/bash
psql $DATABASE_URL
Replicated consolidated
sudo docker exec -ti terraform-enterprise /bin/bash
psql postgres://$TFE_DATABASE_USER:$TFE_DATABASE_PASSWORD@$TFE_DATABASE_HOST/$TFE_DATABASE_NAME?$TFE_DATABASE_PARAMETERS
Docker FDO
docker exec -ti terraform-enterprise-tfe-1 bash
psql postgres://$TFE_DATABASE_USER:$TFE_DATABASE_PASSWORD@$TFE_DATABASE_HOST/$TFE_DATABASE_NAME?$TFE_DATABASE_PARAMETERS
Kubernetes FDO
# Get the Terraform Enterprise pod details
kubectl get pods -n terraform-enterprise
# Example output previous command
NAME READY STATUS RESTARTS AGE
terraform-enterprise-bcc6bbb9f-9qqkj 1/1 Running 0 14m
# Connect to the Terraform Enterprise Pod
kubectl exec --stdin --tty terraform-enterprise-bcc6bbb9f-9qqkj -n terraform-enterprise -- /bin/bash
# Connect with psql
psql postgres://$TFE_DATABASE_USER:$TFE_DATABASE_PASSWORD@$TFE_DATABASE_HOST/$TFE_DATABASE_NAME?$TFE_DATABASE_PARAMETERS