Skip to content

terraform init, TF_WORKSPACE errors after 1.6.0 release #33976

@rileygriffith

Description

@rileygriffith

Terraform Version

Terraform v1.6.0

Terraform Configuration Files

terraform {
  cloud {
    organization = "XXXXX"
    workspaces {
      tags = [ "XXXXX" ]
    }
  }
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = ">= 4.28.0"
    }
  }
}

Debug Output

The only thing in the stacktrace that looked somewhat relevant. It appears to be going to the "default" workspace when the TF_WORKSPACE environment variable defines something else

2023-10-04T19:00:18.825Z [TRACE] backend/local: state manager for workspace "default" will:
 - read initial snapshot from terraform.tfstate
 - write new snapshots to terraform.tfstate
 - create any backup at terraform.tfstate.backup
2023-10-04T19:00:18.825Z [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate
2023-10-04T19:00:18.825Z [TRACE] statemgr.Filesystem: snapshot file has nil snapshot, but that's okay
2023-10-04T19:00:18.825Z [TRACE] statemgr.Filesystem: read nil snapshot
2023-10-04T19:00:18.825Z [TRACE] Meta.Backend: ignoring local "default" workspace because its state is empty
2023-10-04T19:00:18.825Z [TRACE] Meta.Backend: Terraform Cloud mode initialization type: ConfigChangeInPlace
2023-10-04T19:00:18.827Z [TRACE] ModuleInstaller: installing child modules for . into .terraform/modules

Expected Behavior

Should have initialized successfully, as it was prior to the release of 1.6.0.

Actual Behavior

│ Error: Invalid workspaces configuration

│ on main.tf line 5, in terraform:
│ 5: cloud ***

│ Only one of workspace "tags" or "name" is allowed.

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

│ tags - A set of tags used to select remote Terraform Cloud
│ 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 Terraform Cloud workspace to be
│ used with this configuration.
│ When configured, only the specified workspace can be used. This option
│ conflicts with "tags".

Steps to Reproduce

NOTE: I can only reproduce this inside a git action runner, have not been able to replicate it with local commands

  1. terraform init

Additional Context

This issue appears to be common across all of our git actions, and it coincides with the release of version 1.6.0, which happened 1-2 hours ago at the time of writing this

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcloudRelated to Terraform Cloud's integration with Terraformnewnew issue not yet triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions