Introduction
This guide provides instructions on how to change the primary site administrator email address in a Terraform Enterprise instance by accessing the internal Rails console.
Expected Outcome
After following this procedure, you will have successfully updated the site administrator's email address, which is normally uneditable in the Admin settings user interface.
Prerequisites
- Administrative access to the Terraform Enterprise instance host (SSH).
Use Case
This procedure is necessary in the following scenarios:
- You no longer have access to the currently configured administrator email account.
- Promoting another user account to site administrator is not a viable option.
Procedure
- Connect to your Terraform Enterprise instance host using SSH.
-
Launch the Rails console. The command varies depending on your Terraform Enterprise version. Select the command that matches your environment.
For versions
v202205-1throughv202308-1:docker exec -it tfe-atlas /usr/bin/init.sh /app/scripts/wait-for-token -- bash -i -c 'cd /app && ./bin/rails c'
For version
v202309-1and later (FDO or Replicated deployment in consolidated services mode):docker exec -it terraform-enterprise tfectl support console
For older versions (before
v202205-1):docker exec -it ptfe_atlas /usr/bin/init.sh /app/scripts/wait-for-token -- bash -i -c 'cd /app && ./bin/rails c'
-
Within the Rails console, find the administrator account and assign it to a variable. Replace
administrator@email.comwith the current administrator email.user = User.find_by(email: 'administrator@email.com')
-
Update the email address for the user object. The new email address must not already be in use by another account in the system.
user.email = 'yournewadminemail@email.com'
-
Save your changes to the database and then exit the Rails console.
user.save! exit
- Verify the change by navigating to the Admin settings page in the Terraform Enterprise web UI. The new email address should now be displayed for the site administrator.
Additional Information
- For more details on accessing the console, refer to the guide on How To Access the Terraform Enterprise Rails Console.