Introduction
In certain cases, it may be necessary to access the Rails console, a form of command-line interface, to debug Terraform Enterprise issues or, even more rarely, make changes to data.
Use Case
It may be essential to access the Rails console in the following situations.
-
If using SAML and access to the local non-SSO Site Admin user is lost.
-
If a user has lost access to the
owners
team of a given organization.
NOTE: For Terraform Enterprise v202205-1 or later the container names have changed as the "p" has been dropped, and the underscore has been changed to a dash, such as for example in comparison pre v202205-1 container names would suggest ptfe_atlas where v202205-1 and above would reflect tfe-atlas.
Procedure
Please be aware of the following caveats before continuing.
-
Do not access the application console unless directed by HashiCorp Support.
-
Only run the commands provided.
-
If any command returns unexpected output, do not proceed further.
Terraform Enterprise on Replicated
To access the Rails console in Terraform Enterprise on Replicated, perform the following.
-
SSH into the Terraform Enterprise instance.
-
Execute the following command to access the Rails console.
sudo docker exec -it ptfe_atlas /usr/bin/init.sh /app/scripts/wait-for-token -- bash -i -c 'cd /app && ./bin/rails c'
For TFE v202205-1 and above:
sudo docker exec -it tfe-atlas /usr/bin/init.sh /app/scripts/wait-for-token -- bash -i -c 'cd /app && ./bin/rails c'
Terraform Enterprise Consolidated Services on Docker
-
SSH into the Terraform Enterprise instance.
-
Execute the following command to access the Rails console.
For TFE v202309-1 and above running in consolidated_services
mode:
sudo docker exec -it terraform-enterprise tfectl support console
Terraform Enterprise FDO Kubernetes
To access the Rails console in Terraform Enterprise FDO K8S, perform the following:
- Follow the instructions here to connect to the pod.
- Execute the following command in the pod to access the Rails console.
tfectl support console
Terraform Enterprise FDO Podman
To access the Rails console in Terraform enterprise FDO podman:
-
SSH into the Terraform Enterprise instance.
-
Execute the following command to access the Rails console.
podman exec -it terraform-enterprise-terraform-enterprise bash -c ". atlas-env && wait-for-token -- bash -c 'cd /app && ./bin/rails c'"