hashicorp / terraform-provider-tfe

Official HCP Terraform and Terraform Enterprise provider, maintained by HashiCorp. Provision HCP Terraform or Terraform Enterprise - with Terraform!
https://registry.terraform.io/providers/hashicorp/tfe
Mozilla Public License 2.0
167 stars 157 forks source link

v0.49.0 no longers finds local credentials #1086

Open cloutierMat opened 1 year ago

cloutierMat commented 1 year ago

Terraform Cloud/Enterprise version

tfe v0.49.0

Terraform version

Terraform v1.3.4

Terraform Configuration Files

terraform {
  required_version = "1.3.4"

  backend "remote" {
    hostname     = "app.terraform.io"
    organization = "XXXX"

    workspaces {
      prefix = "XXXX-"
    }
  }

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "4.38.0"
    }
    tfe = {
      version = "0.49.0"
    }
  }
}

data "tfe_outputs" "XXXX" {
  organization = "XXXX"
  workspace    = "${var.other_workspace}"
}

output "vpc_id" {
  value = concat(data.tfe_outputs.XXXX.values.vpc_id, [""])[0]
}

Debug Output

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 4.38.0"...
- Finding hashicorp/tfe versions matching "0.49.0"...
- Using previously-installed hashicorp/aws v4.38.0
- Using previously-installed hashicorp/tfe v0.49.0

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
╷
│ Error: Invalid provider configuration
│ 
│ Provider "registry.terraform.io/hashicorp/tfe" requires explicit
│ configuration. Add a provider block to the root module and configure the
│ provider's required arguments as described in the provider documentation.
│ 
╵
╷
│ Error: Failed to initialize HTTP client
│ 
│   with provider["registry.terraform.io/hashicorp/tfe"],
│   on <empty> line 0:
│   (source code not available)
│ 
│ missing API token
╵

Expected Behavior

I should be seeing the id of the vpc managed by the other terraform workspace.

Actual Behavior

Failure to login results in terraform apply to fail.

Additional Context

As stated in the documentation, I have logged on to terraform using the terraform login command. I am using a remote state backend with local execution. With version 0.48.0. there are no issues and my credentials are succesfully used to gather outputs from my other workspaces. It seems to no longer be working with 0.49.0

brandonc commented 1 year ago

Hi! Thanks for the report. v0.49.0 contained #1034, which did seem to break token configuration. That change was reverted and the provider was re-released as v0.49.1 Sorry for the inconvenience!

I will leave this issue open for a bit so that others may find it easier.

cloutierMat commented 1 year ago

Awesome and super quick response! Many thanks! :pray: