Introduction
This article describes how to resolve the Error: port portion contains non-digit characters when configuring the tfe provider for use with HCP Terraform or Terraform Enterprise.
Problem
When you use the tfe provider in your Terraform configuration, you may encounter the following error during the plan phase:
Error: port portion contains non-digit characters
with provider["registry.terraform.io/hashicorp/tfe"]
on XXX.tf line X, in provider "tfe":
provider "tfe" {Cause
This error occurs when the value for the hostname argument in the provider configuration, or the TFE_HOSTNAME environment variable, includes a URL scheme such as http:// or https://. The provider expects only the fully qualified domain name (FQDN).
Solution
To resolve this issue, remove the URL scheme from the address you provide for the hostname argument or the TFE_HOSTNAME environment variable. The value should only be the hostname.
For example, use app.terraform.io for HCP Terraform or tfe.example.com for your Terraform Enterprise instance.
Example
Incorrect Configuration:
provider "tfe" {
hostname = "https://app.terraform.io"
}Correct Configuration:
provider "tfe" {
hostname = "app.terraform.io"
}Additional Information
For more details on this configuration argument, please refer to the TFE Provider hostname argument documentation.