TS_ENV doesn't seem to be working when running all plan

I am attempting to run TS_ENV=test terraspace all plan

However it seems to be setting the environment as new-schema (my previous TS_ENV) even though I’m passing the TS_ENV var as test.

terraspace plan s3: │ Error: error reading S3 Bucket (54dd-mirror-new-schema-avatar): BucketRegionError: incorrect region, the bucket is not in ‘eu-west-2’ region at endpoint ''

Here is my S3 resource code

locals {
  buckets = {
    avatar = {
      versioning = false
    }
  }
}

resource "aws_s3_bucket" "main" {
  for_each = local.buckets

  bucket = "54dd-${local.prefix}-${each.key}"
}

It should be creating the local.prefix from the Terraform environment within my locals.tf

prefix = "mirror-<%= Terraspace.env %>"

However it doesn’t seem to be fetching the TS_ENV I pass in

Unsure. Wondering if you can put together an example repo that reproduces the issue.

Also, try cd into the .terraspace-cache/path/to/stack folder and inspected the generated backend.tf and main.tf. Then try running terraform directly.

Sure, I can try and put together an example for you today.

I just checked out the generated code and it has the correct test prefix local set and everything looks good.

Thank you for your response, appreciate the great work you’ve done with this tool!