Making modules DRYer

If all my modules require an input parameter “environment” so their resources can be named properly, it gets tiring really fast to have this over and over:

module "blah" {
  source = "../some/path"
  environment = var.environment
  ....
}

Is there a way to magically inject that “environment” var into all modules using Terragrunt?

Yes, you can add an input block in your root terragrunt.hcl config file.

Example:
https://github.com/gruntwork-io/infrastructure-live-acme/blob/master/main/terragrunt.hcl#L21

I’m actually using Terragrunt but I still have to pass all the variables in input{} one by one to each module.

Yes, but you can have a root terragrunt configuration, a directory level below where all your modules are defined, if you want to share global inputs or other configurations such as remote state management between all of them. Like in the example I linked in the previous comment.