Create plan in multiple aws regions

Hi
Trying to use terraform to deploy 3 clusters on different AWS regions -

module "clusters" {
  source = "../modules/aws-cluster"

  for_each = toset(["eu-west-1", "us-east-1", "us-west-2"])

  providers = {
    aws = aws.eu-west-1
  }
  environment    = "c${each.key}.${var.environment}"
  region         = each.value
  instance_type  = var.instance_type

The issue is with the provider part since each instance of it should be on a different AWS region.

  providers = {
    aws = aws. ["eu-west-1", "us-east-1", "us-west-2"]
  }

Until now couldn’t find something similar to it. Can someone help, please?

Hi @meni,

Providers in Terraform must be statically assigned to their resources, so there is currently no way to use this pattern to deploy aws resources in multiple regions.

If you need multiple provider configurations, the simplest way to do that would be to have a separate module block for each region, and pass in the desired provider for each case.

i see ,
thank you very much for responding