Additional stacks that reuse a single module in the same environment

I can’t seem to figure out how to create additional stacks that reuse a single module in the same environment.

For example (this works as expected):
app/stacks/ecs/main.tf

module “ecs” “this” {
cluster_name = var.cluster_name
vpc_id = var.vpc_id
}

app/stacks/ecs/tfvars/dev.tfvars

cluster_name = “dev ecs cluster”
vpc_id = <%= output(‘vpc.vpc_id’) %>

I would like to have something like this:

app/stacks/ecs/tfvars/dev/ecs-1.tfvars
app/stacks/ecs/tfvars/dev/ecs-2.tfvars

This way I keep the terraform DRY and only define one instance of the module.

I don’t want to do:
app/stacks/ecs-1/tfvars/dev.tfvars
app/stacks/ecs-2/tfvars/dev.tfvars

Is this possible?

TS_EXTRA may work for you

https://terraspace.cloud/docs/layering/extra/

Turn on show layering to see the available layers

https://terraspace.cloud/docs/layering/debugging/

Run

TS_LAYERING_SHOW_ALL=1
TS_EXTRA=2 terraspace build ecs