How to refer to the value of "terraform.workspce" in terraform-cloud

Hi
How do I get the value of terraform.workspce when running on terraform-cloud?

My environment is vcs linking terraform-cloud and GitHub, but when I execute “terraform plan” in terraform-cloud, the string “default” is entered instead of the workspace name created on terraform-cloud. It will be.

In the following example, it will be “test-default”.

   default_tags {
     tags = {
       Environment = "test-$ {terraform.workspace}"
     }

It has been confirmed that it works normally when “terraform plan” is executed after executing terraform workspace new “workspace name” on the server.
How can I ensure that terraform-cloud references the correct workspace name?

Hi @k_yamamoto,

What you are describing sounds like the behavior of the old remote backend, which runs Terraform in a way that (as you saw) causes the workspace to appear as default.

If you use the first-class Terraform Cloud integration instead then it should get the behavior you were hoping for here, where the workspace names used in Terraform CLI will match the names in Terraform Cloud.

Hi @apparentlymart

By making the following settings based on the information you received, the workspace name will be displayed normally.
thank you.

・Terraform version used in Terraform-cloud changed to 1.1 or higher
・Set tags in Terraform-cloud workspace
・Changed Terraform code for cloud