Per-environment multi-stack variables

I need to tag all my resources with a set of tags that are common across all stacks, but different per environment.

For example all resources have a predefined set of 10 base tags (owner, classification, division, etc) which are the same for all resources within that environment, but some of these have slightly different values for nonprod vs prod.

Is there a way I can specify locals per-environment?

No current way to have env-specific locals as in built in concept like layering or so. Can use conditional logic with erb in the same locals file. Something like:


<% if Terraspace.env == “dev” %>
locals {
  account_name = "my-account"
<% else %>
locals {
  account_name = "my-account-2"
<% end %>

Note: Since ERB is just Ruby, you could read in other files also to maybe clean it up.