Create TFE Token
Configure Terraform to use TFE¶
Once we have Terraform installed, we will configure our local Terraform CLI to authenticate to TFE to run Terraform and have permissions to pull modules out of TFE.
It is not the standard to run Terraform locally. However, in the next lab Terraform Primer, we will run Terraform locally for learning purposes. Terraform will always be run only from the pipeline for dev, model and prod. You may run Terraform locally against sandbox. See docs for more.
Create a personal access token (PAT)¶
Go to your org in TFE and click on User Settings from your User's menu.
Then under Tokens, click on Create an API token and copy the token.
Add the token to your local environment¶
Now, run the following commands in your CLI to finish configuring Terraform to authenticate with Terraform Enterprise.
$TFE_TOKEN='your-personal-TFE-access-token-here'
echo "credentials `"tfe.com`" { token = `"$TFE_TOKEN`" }" | Out-File -FilePath $env:APPDATA/terraform.rc -Encoding ASCII
export TFE_TOKEN=your-personal-TFE-access-token-here
echo "credentials \"tfe.com\" { token = \"$TFE_TOKEN\" }" >> ~/.terraformrc