Question 1 · choose 1
A developer runs terraform login on a laptop. What does the command do with the HCP Terraform API token it obtains?
- AWrites it into the cloud block of the configuration in the current directory
- BSaves it in plain text in credentials.tfrc.json
- CKeeps it in memory only until the terminal is closed
- DStores it in the dependency lock file, encrypted
Show the answer and why
AWrites it into the cloud block of the configuration in the current directory
Incorrect
login never edits configuration files.
BSaves it in plain text in credentials.tfrc.json
Correct
terraform login obtains an API token and by default saves it in plain text in a local CLI configuration file called credentials.tfrc.json.
CKeeps it in memory only until the terminal is closed
Incorrect
The token is saved to disk by default.
DStores it in the dependency lock file, encrypted
Incorrect
The lock file holds provider selections, not credentials.
login is for interactive machines; protect or relocate the saved token.
HashiCorp documentation