Create multiple S3 buckets at once
You can make changes in Main.tf as specified below:

resource "aws_s3_bucket" "b" {
  count      = "${length(var.domain_name)}"
  bucket     = "${element(var.domain_name, count.index)}"
  acl        = "public-read"
  policy     = "${file("bucket-policy.json")}"

  website {
    index_document = "index.html"
    error_document = "error.html"

    routing_rules = &lt;&lt;EOF
EOF
  }
}