How to create AWS resources in multiple regions using for loop

I'm trying to launch AWS Config and rules in each region in my account. Right now in my root I create an AWS provider in a single region and call my AWS Config module from my modules directory. This is fine for creating one module, but I would be hoping to have a regions list that I could iterate over to create AWS Config rules in each

I have tried creating individual modules with region as a parameter, but I do not know if 10+ different modules is effective. It seems using a for loop would be more effective, but I cant find any examples for this behavior.

provider "aws" {
  region  = "${var.aws_region}"

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

My goal is to use my config modules over all and create them in all regions. us-east-1, us-east-2, us-west1-, etc etc

Read more here:

Content Attribution

This content was originally published by DanMan at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: