Feature request - native YAML tfvars; workspace aware tfvars

For the use case of flexible configs that use different sets of tfvars for different workspaces (we commonly use this pattern to support different environments - ie: dev/staging/prod with the same config). A couple things on my wishlist :smiley:

  • as JSON tfvars (re: *.auto.tfvars.json) are supported, the same would be great for YAML (*.auto.tfvars.yaml). Reason being the benefits of readability, forgiving syntax, modest dynamic features using anchors/references, and more concise syntax than JSON

  • would be beautiful if there were a variation on auto tfvars that were coupled to the workspace. I emulate this in code currently but it is somewhat clunky and has the unfortunate side effect of requiring a “shim” module to do variable validation; it would be much cleaner to do this all in the top level config.

module "validate" {
  source = "./modules/validate"

  config = yamldecode(

# necessitates somewhat clunky variable references
module "net" {
  source = "./modules/terraform-google-net"

  addresses             = module.validate.config.net.addresses
  gcp                   = module.validate.config.gcp
  metadata              = module.validate.config.metadata