To change the password of the admin account in Terraform Enterprise, you can use the Admin API. Here's the step-by-step process:
-
Create a User Token: First, you need to create a user token using the "Tokens" tab in the user settings page.
https://developer.hashicorp.com/terraform/enterprise/users-teams-organizations/users#api-tokens - Prepare the Request Body: Create a file called adminpassword.json with the following content:
{
"data": {
"type": "users",
"attributes": {
"current_password": "*****",
"password": "****",
"password_confirmation": "*****"
}
}
}
Replace the placeholders (*****) with your current password and the new password you want to set.
3. Make the API Request: Use the following cURL command to change the admin password:
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request PATCH \
--data @adminpassword.json \
https://ramit-bansal.tf-support.hashicorpdemo.com/api/v2/account/password
Replace $TOKEN with the user token you created in step 1.
Alternatively, you can also reset the Terraform Enterprise Administrator Password via the Rails console, as documented in the following article:
Please note that the Admin API method is the recommended approach, as it provides a more secure and streamlined process for changing the admin password.