Skip to content

Formatting on error message --- Error: Invalid workspaces configuration #38137

@benjamin-lykins

Description

@benjamin-lykins

Terraform Version

Terraform v1.14.4

Terraform Configuration Files

Was missing the workspaces{} field.

terraform {
  cloud {
    organization = "lykins"
  }
}

Debug Output

Not necessary

Expected Behavior

In this error message, tags and name should be bold in the output. Apologies for the formatting in this section since I couldn't use a code block to format.

│ Error: Invalid workspaces configuration

│ on terraform.tf line 2, in terraform:
│ 2: cloud {

│ Missing workspace mapping strategy. Either workspace "tags" or "name" is required.

│ The 'workspaces' block configures how Terraform CLI maps its workspaces for this single
│ configuration to workspaces within an HCP Terraform or Terraform Enterprise organization. Two strategies are available:

tags- A set of tags used to select remote HCP Terraform or Terraform Enterprise workspaces to be used for this single
│ configuration. New workspaces will automatically be tagged with these tag values. Generally, this
│ is the primary and recommended strategy to use. This option conflicts with "name".

name - The name of a single HCP Terraform or Terraform Enterprise workspace to be used with this configuration.
│ When configured, only the specified workspace can be used. This option conflicts with "tags"
│ and with the TF_WORKSPACE environment variable.

Actual Behavior

Instead, it is outputting like this: [bold]attribute[reset]

│ Error: Invalid workspaces configuration
│ 
│   on terraform.tf line 2, in terraform:
│    2:   cloud {
│ 
│ Missing workspace mapping strategy. Either workspace "tags" or "name" is required.
│ 
│ The 'workspaces' block configures how Terraform CLI maps its workspaces for this single
│ configuration to workspaces within an HCP Terraform or Terraform Enterprise organization. Two strategies are available:
│ 
│ [bold]tags[reset] - A set of tags used to select remote HCP Terraform or Terraform Enterprise workspaces to be used for this single
│ configuration. New workspaces will automatically be tagged with these tag values. Generally, this
│ is the primary and recommended strategy to use.  This option conflicts with "name".
│ 
│ [bold]name[reset] - The name of a single HCP Terraform or Terraform Enterprise workspace to be used with this configuration.
│ When configured, only the specified workspace can be used. This option conflicts with "tags"
│ and with the TF_WORKSPACE environment variable.

Steps to Reproduce

  1. terraform init

Additional Context

No response

References

None that i could find existing

Generative AI / LLM assisted development?

None

Metadata

Metadata

Assignees

Labels

bugnewnew issue not yet triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions