Organizing Terraform modules for multiple environments is an essential best practice to ensure maintainability and consistency across different environments. Here's an example of how to organize Terraform modules for multiple environments:

1. Create a directory structure for your Terraform modules:

.
├── main.tf
├── variables.tf
├── outputs.tf
├── modules
│   ├── vpc
│   ├── ec2
│   ├── rds
│   └── ...
├── staging
│   ├── main.tf
│   ├── variables.tf
│   ├── outputs.tf
│   └── ...
├── production
│   ├── main.tf
│   ├── variables.tf
│   ├── outputs.tf
│   └── ...
└── ...

2. Create a main.tf, variables.tf, and outputs.tf file for your root module. This is where you will define your provider, any shared resources, and input/output variables.

3. Create a modules directory to store your reusable modules.

4. Create a module for each resource type (e.g., VPC, EC2, RDS) and place them in the modules directory.

5. Create environment-specific directories (e.g., staging, production) and include a main.tf, variables.tf, and outputs.tf file for each environment. You can also include any environment-specific resources in these directories.

6.Use the modules in your environment-specific main.tf files, passing in any necessary variables defined in the variables.tf files. For example:
module "vpc" {
  source = "../modules/vpc"

  name        = var.vpc_name
  cidr_block  = var.vpc_cidr_block
  tags        = var.vpc_tags
}
 
module "ec2" {
  source = "../modules/ec2"

  ami_id      = var.ec2_ami_id
  instance_type = var.ec2_instance_type
  vpc_id      = module.vpc.id
  tags        = var.ec2_tags
}
In this example, the vpc module is used to create a VPC, and the ec2 module is used to create an EC2 instance in that VPC.

7. Use environment-specific variables.tf files to configure variables for each environment. For example:
# staging/variables.tf
variable "vpc_cidr_block" {
  default = "10.0.0.0/16"
}

variable "ec2_ami_id" {
  default = "ami-0c55b159cbfafe1f0"
}

variable "ec2_instance_type" {
  default = "t2.micro"
}

8. Use environment-specific main.tf files to define any environment-specific resources or overrides. For example:
# staging/main.tf
resource "aws_security_group_rule" "allow_ssh" {
  type        = "ingress"
  from_port   = 22
  to_port     = 22
  protocol    = "tcp"
  cidr_blocks = ["10.0.0.0/16"]
}
In this example, an additional security group rule is added to allow SSH access from the 10.0.0.0/16 CIDR block in the staging environment.

By organizing your Terraform modules in this way, you can maintain consistency across multiple environments while also reusing code and minimizing duplication.