Intro
This article describes how to retrieve the last modified value of the Terraform Enterprise Built-in Administrator Password.
Problem
The last modified date value of the Password for the Built-in Administrator account of Terraform Enterprise is not shown in the UI or retrievable through the API.
Solution
Retrieve the value from the database.
1- Connect to the postgres database according the TFE type installed:
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
2- Execute the query below, after replacing the <USERNAME> value with the actual username:
select email, username, reset_password_token, created_at, updated_at from rails.users where username='<USERNAME>';
The returned value is the updated_at
value, which shows the date value when the line was last updated.