Skip to content

tfe_workspace_run fail for empty workspace #1939

@jaroslavkafka-ata

Description

@jaroslavkafka-ata

Terraform Enterprise version

Terraform version

v1.14.3

Terraform Configuration Files

resource "tfe_workspace" "this" {
  name              = "..."
  organization      = data.tfe_organization.this.name
  project_id        = data.tfe_project.this.id
  terraform_version = ">= 1.12, < 2.0"
}

resource "tfe_workspace_run" "this" {
  workspace_id = tfe_workspace.this.id

  destroy {
    manual_confirm    = false
    retry             = true
    retry_attempts    = 3
    retry_backoff_min = 10
    retry_backoff_max = 30
    wait_for_run      = true
  }
}

Debug Output

│ Error: error creating run for workspace ws-7xTk3aNBB......: unprocessable entity
│ 
│ Configuration version is missing

Expected Behavior

The destroy workspace run should execute successfully and must not fail even when the workspace contains no resources.
Use case:

  1. We create a workspace along with a tfe_workspace_run and several other resources.
  2. Terraform code that uses this workspace is applied from a separate CI/CD pipeline.
  3. In some edge cases (unhappy paths), the apply step in (2) fails, leaving the workspace empty (no Terraform resources in the state).
  4. As part of the workspace lifecycle, we then remove the workspace created in (1). This triggers a destroy run, as expected. However, the destroy run fails with the error Configuration version is missing.
    While this behavior is technically expected when no resources exist, there should be an option to suppress this error and allow the destroy run to succeed.

Actual Behavior

destroy run of tfe_workspace_run fails with Configuration version is missing.

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions