Bootstrap FreeKB - Terraform - Log out of Terraform Cloud using the terraform logout command
Terraform - Log out of Terraform Cloud using the terraform logout command

Updated:   |  Terraform articles

The terraform login command can be used to log into your Terraform Cloud account. The terraform login command with no options will be interactive, where you will be prompted to enter your Terraform Cloud username and password.

]$ terraform login
Terraform will request an API token for app.terraform.io using your browser.

If login is successful, Terraform will store the token in plain text in
the following file for use by subsequent commands:
    /home/jeremy.canfield/.terraform.d/credentials.tfrc.json

Do you want to proceed?
  Only 'yes' will be accepted to confirm.

  Enter a value:

 

Next you will be prompted to go to https://app.terraform.io/app/settings/tokens?source=terraform-login which should provide you with a token.

---------------------------------------------------------------------------------

Open the following URL to access the tokens page for app.terraform.io:
    https://app.terraform.io/app/settings/tokens?source=terraform-login


---------------------------------------------------------------------------------

Generate a token using your browser, and copy-paste it into this prompt.

Terraform will store the token in plain text in the following file
for use by subsequent commands:
    /home/john.doe/.terraform.d/credentials.tfrc.json

Token for app.terraform.io:
  Enter a value:

 

Enter this token at the prompt and if all goes well, something like this should be returned.

Token for app.terraform.io:
  Enter a value:


Retrieved token for user johndoe


---------------------------------------------------------------------------------

                                          -
                                          -----                           -
                                          ---------                      --
                                          ---------  -                -----
                                           ---------  ------        -------
                                             -------  ---------  ----------
                                                ----  ---------- ----------
                                                  --  ---------- ----------
   Welcome to Terraform Cloud!                     -  ---------- -------
                                                      ---  ----- ---
   Documentation: terraform.io/docs/cloud             --------   -
                                                      ----------
                                                      ----------
                                                       ---------
                                                           -----
                                                               -


   New to TFC? Follow these steps to instantly apply an example configuration:

   $ git clone https://github.com/hashicorp/tfc-getting-started.git
   $ cd tfc-getting-started
   $ scripts/setup.sh

 

Once done, the terraform logout command can be used to log out of Terraform Cloud.

]$ terraform logout
Removing the stored credentials for app.terraform.io from the following file:
    /home/john.des/.terraform.d/credentials.tfrc.json

Success! Terraform has removed the stored API token for app.terraform.io.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 7a20d5 in the box below so that we can be sure you are a human.