Document Suffix

Hello All,

I have created the following resources and modules in my main.tf file as follows:

resource "aws_s3_bucket" "s3bucketcopeland" {
  bucket = "s3bucketcopeland"
  acl    = "public-read"
}

module "aws_s3_bucket" {
  bucket = "s3bucketcopeland"
  source = "terraform-aws-modules/s3-bucket/aws"
  
}

resource "aws_s3_bucket_acl" "s3bucketcopeland_acl"{
  bucket = aws_s3_bucket.s3bucketcopeland.id
  acl    = "public-read"
}

resource "aws_s3_bucket_policy" "s3bucketcopeland_policy"{
  bucket = aws_s3_bucket.s3bucketcopeland.id
  policy = <<POLICY
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::${aws_s3_bucket.s3bucketcopeland.id}/*"
    }
  ]
}
POLICY
}

resource "aws_s3_bucket_website_configuration" "s3bucketcopeland_website"{
  bucket = aws_s3_bucket.s3bucketcopeland.id

 
}

resource "aws_s3_bucket_object" "s3bucketcopeland_object"{
  bucket = aws_s3_bucket.s3bucketcopeland.id
  key    = "index.html"
  source = "index.html"
  acl    = "public-read"

}

When I apply said resources, I get the following error:

 Error: error creating S3 bucket (s3bucketcopeland) website configuration: InvalidArgument: A value for IndexDocument Suffix must be provided if RedirectAllRequestsTo is empty

I am told to add the following:

index_document_suffix = "index.html"

However, when I do this, I get the following:

Error: Unsupported argument
│ 
│   on main.tf line 233, in resource "aws_s3_bucket" "s3bucketcopeland":
│  233:   index_ocument_suffix = "index.html"
│ 
│ An argument named "index_ocument_suffix" is not expected here.

It seems like if I add this, it kicks out an error, but when I remove it, it also kicks out an error. I am a bit confused on this one. Any help would be greatly appreciated. Thanks in advance.

Look more closely at the error - you have a typo - ocument is not a word.

Thanks for that…I feel like a real idiot