Accessing Terraform cloud Module registry programatically
First step is to get your personal token. Log on to Terraform Cloud, go to https://app.terraform.io/app/settings/tokens and generate new token.
Note: it is important to save the token to safe place - this is only time you will see it.
Export the token:
export TFE_TOKEN=<THE-TOKEN-VALUE> The documentation for Terraform API is here
It is OK documentation but not the greatest one, however. There are two versions of the API - v1 and v2 and this is not clearly described. It could also used better examples.