Configures an S3 bucket for website hosting with multiple routing rules defined in JSON format.

Terraform Template

resource "aws_s3_bucket_website_configuration" "example" {
  bucket = "aws_s3_bucket.example.id"

  error_document {
    key = "error.html"
  }

  index_document {
    suffix = "index.html"
  }
  routing_rules = <<-EOF
    [{
     "Condition": {
     "KeyPrefixEquals": "docs/"
     },
     "Redirect": {
     "ReplaceKeyPrefixWith": ""
     }
    }]
    
  EOF
}