Skip to content

The tfe_variable resource's value_wo argument does not work with variable sets #1718

Open
@ryan-at-ld

Description

@ryan-at-ld

Terraform Enterprise version

The bug is reproducible with both HCP Terraform and Terraform Enterprise. I am using Terraform Enterprise 202501-1.

Terraform version

Terraform v1.11.4
on darwin_arm64
+ provider registry.terraform.io/hashicorp/tfe v0.65.2
...

Terraform Configuration Files

terraform {
  required_providers {
    tfe = {
      source  = "hashicorp/tfe"
      version = "0.65.2"
    }
  }
  required_version = "~> 1.11"
}

provider "tfe" {}

variable "test" {
  default   = "foo"
  ephemeral = true
}

resource "tfe_variable_set" "test" {
  name = "tfe-ephemeral-testing"
}

resource "tfe_variable" "varset" {
  category        = "env"
  key             = "tfe_ephemeral_test"
  value_wo        = var.test
  variable_set_id = tfe_variable_set.test.id
}

resource "tfe_workspace" "test" {
  name       = "tfe-ephemeral-testing"
  auto_apply = false
}

resource "tfe_variable" "workspace" {
  category     = "env"
  key          = "tfe_ephemeral_test"
  value_wo     = var.test
  workspace_id = tfe_workspace.test.id
}
...

Debug Output

I can supply debug output if necessary. I haven't included any because this is pretty easy to reproduce.

Expected Behavior

When applying the above Terraform configuration, I expect the tfe_ephemeral_test variable to contain the value "foo" in both the variable set's variable and the workspace's variable.

Actual Behavior

The variable set's variable is unset where as the workspace's variable is correctly populated.

Image

Image

Image

In addition to the lack of a value, subsequent Terraform plans of the same configuration include a change to replace the variable set's variable because it doesn't have the expected value. The workspace's variable does not appear in the plans.

Image

Additional Context

I am not using any additional tooling or wrappers.

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