terraform-provider-tfe icon indicating copy to clipboard operation
terraform-provider-tfe copied to clipboard

Running TFE resources on terraform cloud without a TFE_TOKEN should give a meaningful error message

Open bjmask opened this issue 5 years ago • 2 comments

Without TFE_TOKEN:

Error: Error creating env variable AWS_ACCESS_KEY_ID: resource not found

on main.tf line 59, in resource "tfe_variable" "AWS_ACCESS_KEY_ID": 59: resource "tfe_variable" "AWS_ACCESS_KEY_ID" {

With tfe token:

AWS_ACCESS_KEY_ID: Creating... AWS_ACCESS_KEY_ID: Creation complete after 1s [id=var-s5WHTKna5g3m81qd]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

bjmask avatar Dec 02 '19 21:12 bjmask

Please :D

bjmask avatar Jan 22 '20 16:01 bjmask

IMO, fixing the error message would be a first step. It should however be possible to create variables in Terraform Cloud workspaces without having to deploy manually first a TFE_TOKEN variable in said workspaces. That more or less defeats the purpose of using TFE as a Terraform Cloud automation resource.

The current user experience for this is confusing and described also in issue #102 and its comments.

unknownterritory avatar Mar 31 '20 19:03 unknownterritory

Hi, there. I do believe this has been the case for quite a while. When I unset TFE_TOKEN and don't otherwise provide credentials (through terraform login or the provider block) I see this error:

$ TFE_TOKEN="" terraform apply
╷
│ Error: Required token could not be found. Please set the token using an input variable in the provider configuration block or by using the TFE_TOKEN environment variable.
│
│   with provider["registry.terraform.io/hashicorp/tfe"],
│   on main.tf line 1, in provider "tfe":
│    1: provider "tfe" {
│
╵

brandonc avatar Dec 21 '22 22:12 brandonc