Introduction
To change the password of the admin account in Terraform Enterprise, you can use the Admin API.
Expected Outcome
Changing the password of the admin account of Terraform Enterprise with the Admin API.
Procedure
-
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.
- 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.tf-support.hashicorpdemo.com/api/v2/account/password
- Replace $TOKEN with the user token you created.
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.
Additional Information
- Account API - https://developer.hashicorp.com/terraform/enterprise/api-docs/account